[ Quoting <[email protected]> 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
signature.asc
Description: Digital signature
_______________________________________________ Opendnssec-user mailing list [email protected] https://lists.opendnssec.org/mailman/listinfo/opendnssec-user
