Posted By: Thels

## $utc - 13/07/15 09:10 AM

The $gmt value seems a bit flaky. I assumed it displayed the number of seconds that have passed since January 1 1970 01:00:00, but it seems I was wrong.

I live in GMT+1. Daylight saving time is currently in effect, which adds another hour, so I'm 2 hours ahead of Coordinated Universal Time.

I wrote an alias to echo the following variables at the exact same time:

$fulldate: Mon Jul 13 11:00:17 2015

$ctime: 1436778017

$calc(($ctime % 86400) / 3600): 9.004722

$gmt: 1436770817

$calc(($gmt % 86400) / 3600): 7.004722

$daylight: 3600

$timezone: -7200

86400 is 60 * 60 * 24, thus, the number of seconds in a day. The number of seconds should have been from Januari 1 1970 at 01:00:00, so considering it's 11 o'clock local time, it should've been 10 o'clock without daylight saving time, or 9 o'clock universal time, which is 8 hours after that 1 o'clock. However, $gmt is only 7 hours past a full number of days, so it accounts for daylight saving time somewhere. Still, $ctime is still 2 hours ahead of $gmt.

This is all really flaky to work with. Sure, $asctime will give me the correct date and time, but with timers and stuff, it's a lot easier to work with the original numbers, than convert them to time, and decypher the values from there.

Could you add a function such as $utc that returns the exact number of seconds that have passed since a certain moment in the past, without correcting itself to Daylight Saving Time in any way? Preferably, this would start counting from midnight GMT (such as Jan 01 1970 00:00:00), so it's easy to calculate the exact number of days that have passed since then.

Kind regards,

Thels.

I live in GMT+1. Daylight saving time is currently in effect, which adds another hour, so I'm 2 hours ahead of Coordinated Universal Time.

I wrote an alias to echo the following variables at the exact same time:

$fulldate: Mon Jul 13 11:00:17 2015

$ctime: 1436778017

$calc(($ctime % 86400) / 3600): 9.004722

$gmt: 1436770817

$calc(($gmt % 86400) / 3600): 7.004722

$daylight: 3600

$timezone: -7200

86400 is 60 * 60 * 24, thus, the number of seconds in a day. The number of seconds should have been from Januari 1 1970 at 01:00:00, so considering it's 11 o'clock local time, it should've been 10 o'clock without daylight saving time, or 9 o'clock universal time, which is 8 hours after that 1 o'clock. However, $gmt is only 7 hours past a full number of days, so it accounts for daylight saving time somewhere. Still, $ctime is still 2 hours ahead of $gmt.

This is all really flaky to work with. Sure, $asctime will give me the correct date and time, but with timers and stuff, it's a lot easier to work with the original numbers, than convert them to time, and decypher the values from there.

Could you add a function such as $utc that returns the exact number of seconds that have passed since a certain moment in the past, without correcting itself to Daylight Saving Time in any way? Preferably, this would start counting from midnight GMT (such as Jan 01 1970 00:00:00), so it's easy to calculate the exact number of days that have passed since then.

Kind regards,

Thels.