[kdepim-users] Date Conundrum
Ingo Klöcker
kloecker at kde.org
Thu Dec 3 19:19:08 GMT 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdepim-users/attachments/20091203/b61cda43/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM users mailing list
kdepim-users at kde.org
https://mail.kde.org/mailman/listinfo/kdepim-users
More information about the kdepim-users
mailing list