Page 1 of 1

Date() optionally returning UTC time

Posted: Fri Nov 14, 2008 12:20 pm
by RichardL
Hi,
Much of my software ends up spread around the world and I often need to know the UTC time on a machine; not the local time.

Internally PCs are UTC aware, would it be possible for:

Date() or Date(0) to return local time as it does now.
Date(1) to return UTC time.

Richard L

Posted: Fri Nov 14, 2008 3:45 pm
by Rook Zimbabwe
After JAn 1 subtract 34 seconds from their clocks and use format date thussly:

Code: Select all

UTC$ = formatdate("%yyyy %mm %dd,  %hhh %iim %sss", date()-34)
:wink:

Posted: Sat Nov 15, 2008 10:30 am
by Rescator
Erm, huh? Rook your confusing UTC with UT1 and TIA.

UTC is affected by leap seconds. (on systems that use network time correction like Windows, Mac and most Linux the time is corrected automatically).


As to RichardL's question, it's already been suggested but as a seperate function instead: http://www.purebasic.fr/english/viewtopic.php?t=23172

In the meantime (for those curious) this should get the job done:
http://www.purebasic.fr/english/viewtopic.php?t=35195