This is the dangdest thing.
I've had this same code running for about 10 years, to determine 14 days from today:
$duration = 14;
$expiration = 0;
# blah blah blah
if (!$expiration) {
$expiration_time = time + ($duration * 86400);
($expire_sec, $expire_min, $expire_hour, $expire_day, $expire_mon, $expire_year, $expire_wday) = localtime($expiration_time);
$expire_month = $expire_mon + 1;
$expire_year += 1900;
$expiration = sprintf("%d%02d%02d", $expire_year, $expire_month, $expire_day);
}
(in retrospect, I don't know why I assign $expire_mon and $expire_month separately like that, I should just use $expire_month and then $expire_month++... but like I said, I wrote it forever ago so God knows what I was thinking or preparing for)
So in the end, $expiration should be a format like 20180313, which would be 14 days from 20180227 (today).
But for the last week or so, at around 11pm it's suddenly advancing
15 days instead of 14! It's as if the server thinks that the time is changing an hour earlier than it is...
... but it's not. I have another script that shows posts with the current server time, and that time is correct. And when I SSH in and use
date, it shows the correct time. So the flaw is happening somewhere with
time or
localtime.
Why it suddenly started happening recently, I have no idea. Unless there was an automated server update or something that's changed something? I'm running CentOS 6.9 xen hvm.
Do you guys see what could be causing this flaw?