Windows 7 Ultimate 64bit NL, Service Pack 1.
(UTC+01:00) Amsterdam, Berlijn, Bern, Rome, Stockholm, Wenen
When I do $asctime($gmt), I do get the correct current universal time. But if I try to work with the number of seconds itself, for example, to see how much time has passed or to set up timers, I'm a little confused. I thought $ctime and $gmt were meant to count back to January 1 1970 00:00:00, but if I try this at 10:36 am local time:
//echo GMT: $calc(($gmt % 86400) / 3600) CTIME: $calc(($ctime % 86400) / 3600)
GMT: 6.601111 CTIME: 8.601111
So CTIME doesn't count back to midnight, but to 2 am (which would be Midnight in universal time), whereas GMT counts back to 4 am (2am universal time).
EDIT: I've been messing some more, and it seems I've simply been misunderstanding how these values work.
$ctime actually provides the number of seconds that have passed since 1-1-1970 00:00:00 GMT, regardless of what timezone you're in, or if daylight savings is active.
$asctime takes a timevalue, and returns a readable format that is adjusted to the current timezone.
$gmt provides a certain timevalue that opposes the current timezone, so that $asctime would come up with the readable format for GMT.
I had assumed that $ctime would be adjusted to your local timezone, and $gmt would be universal, but it's actually opposite. It's a bit confusing at first.
So yeah, apologies for my initial request.
I still have a request, though. It would be nice if there was an alternative for $asctime that would display the GMT/UTC time (without DST) for a certain $ctime value, without having to set my computer's timezone to GMT/UTC.
For example, if I stored $ctime values of events in the past, I want to know the actual GMT/UTC times of those moments. I can't subtract my current timezone, because I don't know if my current timezone was the same back then, due to DST. Something like an $ascgmt would be nice for that.
Last edited by Thels; 15/07/15 12:49 PM.