QB64.org Forum
Active Forums => Programs => Topic started by: luke on August 30, 2019, 09:07:32 am
-
Steve has a function here (https://www.qb64.org/forum/index.php?topic=1638.0) that generates a timestamp based on the Unix timestamp, seconds since 1/1/1970. However, it's rather... complex, and doesn't take into account the silliness that is daylight saving.
Here's a simpler one. Works on both Windows & Linux, returns the Unix timestamp.
DECLARE LIBRARY
FUNCTION time& (BYVAL null&)
END DECLARE
PRINT timestamp
FUNCTION timestamp&
timestamp& = time&(0)
END FUNCTION
-
Hi Luke,
Can you do different date+time conversions to seconds?
-
If you want to map these to actual datetimes, go use Steve's function.
This is for if you need a reliable counter like TIMER that doesn't suffer from wrap-around, daylight saving, timezones etc.