Date() optionally returning UTC time

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Date() optionally returning UTC time

Post 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
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post 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:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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
Post Reply