27 Jul
2006
27 Jul
'06
1:24 p.m.
Hi, I'm currently using the following code to calculate the number of seconds until the next month. I'm wondering whether there's an easier way. date d(day_clock::universal_day()); d += months(1); cout << duration2a((ptime(date(d.year(), d.month(), 1)) - second_clock::universal_time()).total_seconds()) + " until ladders reset" << endl; return 0;
28 Jul
28 Jul
4:54 a.m.
Olaf van der Spek wrote: > Hi, > > I'm currently using the following code to calculate the number of > seconds until the next month. I'm wondering whether there's an easier > way. > > date d(day_clock::universal_day()); > d += months(1); > cout << duration2a((ptime(date(d.year(), d.month(), 1)) - second_clock::universal_time()).total_seconds()) + " until ladders > reset" << endl; > return 0; Not tested, but I think should work...not sure it's much easier... date d(day_clock::universal_day()); ptime month_start (d.end_of_month() + days(1)); cout << (month_start - second_clock::universal_time()).total_seconds() Jeff
6683
Age (days ago)
6684
Last active (days ago)
1 comments
2 participants
participants (2)
-
Jeff Garland
-
Olaf van der Spek