Hello all.
I've run across an interesting (from my perspective) issue with an app I'm maintaining. I wanted a script to wait 10 seconds and see if a particular file had been modified in that interval, like so:
$start_time = time();
sleep(10);
$mod_time = filemtime('filename.txt');
if ($mod_time > $start_time) {
...some code...
}
'date_default_timezone_get()' tells me that the default timezone is GMT, and 'time()' sends back a timestamp set for GMT. However, 'filemtime()' sends back a timestamp set for my local timezone, which is EST (GMT -5).
In php, I get the same timezone offset for both $start_time and $mod_time: 0. So it would seem that both stamps are being treated as GMT.
I need to be able to do the comparison and I don't want to hard code the timezone, so is there a way to get the timezone from the operating system?
Any insight would be seriously appreciated.