Extended (Unix Epoch) TimerContributor(s):
@SMcNeillSource: qb64 @ Freeforums
URL:
http://qb64.freeforums.net/thread/20/extended-timer-uetTags: [date], [time], [timer]
Description:
The Unix Epoch Time is a popular timekeeping standard based on the number of seconds elapsed since midnight on Jan 1, 1970 in Greenwich, London. The Extended Timer function below will calculate the (relative) Unix epoch time from the local system time and date.Source Code:
SHELL "https://www.epochconverter.com/" PRINT "Compare to the time at https://www.epochconverter.com/"
l1
= INSTR(l
+ 1, d$
, "-") SELECT CASE i
'Add the number of days for each previous month passed CASE 1: d
= d
'January doestn't have any carry over days. CASE 2, 4, 6, 8, 9, 11: d
= d
+ 31 CASE 5, 7, 10, 12: d
= d
+ 30 d = d + 365
IF m
> 2 THEN d
= d
+ 1 'add an extra day for leap year every 4 years, starting in 1970 d = d - 1 'for year 2000
s~&& = d * 24 * 60 * 60 'Seconds are days * 24 hours * 60 minutes * 60 seconds
ExtendedTimer##
= (s~&&
+ TIMER)