Re: Date Conundrum
Ingo Klöcker <[email protected]>
| Newsgroups | gmane.comp.kde.users.pim |
|---|---|
| Message-ID | <[email protected]> |
On Thursday 03 December 2009, Anne Wilson wrote:
> I get security alerts from my Netgear router, and they displayed as
> expected until 1st July (IIRC) when they suddenly started showing the
> date as one month ahead. I ignored it, really, up to now, but of
> course from this week, one month ahead puts me into next year. To my
> surprise, though, they started showing the 010170 date. On
> examination, is see the same problem as in the previous post:
>
> Date: Thu,3 (null) 2009 01:00:00 -0000 (GMT Daylight Time)
>
> whereas the last day of November, it showed
>
> Date: Mon,30 Dec 2009 20:56:19 -0000 (GMT Daylight Time)
LOL. This looks like an off-by-one error.
Let's say we have a list of the short month names.
monthNames = { Jan, Feb, ..., Dec }
As usual in most programming languages the indices start with 0,
i.e. "Jan" == monthNames[0], ..., "Dec" == monthNames[11].
But in the real world counting starts by 1. So January == 1, ...,
December == 12.
The code creating the date header apparently doesn't take into account
the difference between counting in the real world and in the virtual
world. For November it took the 11th element from the list of
monthNames which is "Dec" and for December it tried to take the 12th
element from the list of monthNames. Since this 12th element doesn't
exist we get "(null)". :-)
Regards,
Ingo
_______________________________________________
KDE PIM users mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kdepim-users
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAksYDy0ACgkQGnR+RTDgudgOzQCfZbfQjw28NcTQcFYGY6MmULkI MZkAni2Txt+jjJdUOdmS+m0YETDbpRDl =q07O -----END PGP SIGNATURE-----