By my calculation (which may well be wrong), subtracting 24 to determine yesterday's date is wrong during one one-hour period per year, and adding 24 hours to determine tomorrow's date is wrong during a second one-hour period, each period corresponding to one of the adjustments.
If I'm wrong, please set me straight.
Updated:
I wasn't 100% sure I was right, so I did a bit of research and an experiment with Time::Local. At least in most of the U.S. (there are exceptions, dammit), we do the daylight savings switch by either repeating 1-2am on the first Sunday of April, by by skipping from 1:59:59 to 3:00:00am on the last Sunday of October. In either case, it's save to subtract 24 hours from the current time for the purposes of determining the previous date.
Nope, I was right the first time.
| [reply] |
You are wrong. During a year there will be a 23 hour day and a 25 hour day. For the hour before the 23 hour day, adding 24 hours to get tomorrow's date won't work, it will get the day after tomorrow's date. For the first hour of the 25 hour day, adding 24 hours will get the same day's date. For the hour after the 23 hour day, subtracting 24 hours will get the date two days ago. For the last hour of the 25 hour day, subtracting 24 hours will get the same day's date.
| [reply] |