[Opendnssec-user] Opendnssec signer Y2K bug?
Miek Gieben
miek at miek.nl
Fri Dec 23 12:38:26 UTC 2011
[ Quoting <rickard at opendnssec.org> at 13:10 on Dec 23 in "Re: [Opendnssec-user..." ]
> The issue was that we got the wrong year, so I am guessing that the
> problem may be in the function
> ldns_year_and_yday_from_days_since_epoch()
I've extracted that code in a separate program:
% date -d "now + 9 days"
Sun Jan 1 13:33:26 CET 2012
% date +%s -d "now + 9 days"
1325421327
Using this number in my program (t.c):
45 void main() {
46 struct tm time;
47 //int64_t seconds = 1324643172; // now
48 //int64_t seconds = 1330000272; // now + 2 months
49 // int64_t seconds = 1325507505; // now + 10 days
50 int64_t seconds = 1325421327; // now + 9 days
51 int64_t days = LDNS_DIV(seconds, 60);
52 days = LDNS_DIV(days, 60);
53 days = LDNS_DIV(days, 24);
54
55 ldns_year_and_yday_from_days_since_epoch(days, &time);
56
57 printf("Year %d, Yday %d", time.tm_year, time.tm_yday);
58 }
% ./t
Year 2012, Yday 365
Using today +10 days:
% date +%s -d "now + 10 days"
1325507811
% ./t
Year 2012, Yday 1%
There is a bug here. I'm digging further.
grtz,
--
Miek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.opendnssec.org/pipermail/opendnssec-user/attachments/20111223/f2d2d989/attachment.bin>
More information about the Opendnssec-user
mailing list