Community discussions

MikroTik App
 
sejtam
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 67
Joined: Sun Dec 14, 2014 4:23 pm

Access date in UTC from script

Thu Jan 11, 2018 6:50 am

Is there any way to access the date in UTC (or the UNIX/epoch/time_t time (seconds since Jan 1 1970))
from a script?
 
sejtam
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 67
Joined: Sun Dec 14, 2014 4:23 pm

Re: Access date in UTC from script

Thu Jan 11, 2018 7:44 am

Also: can I define a scheduler which triggers on a UTC time rather than the local time?
(yes I know i coudl just run the script hourly and then in it test the date, but that seems wasteful)
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1782
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Access date in UTC from script

Fri Jan 12, 2018 6:19 pm

How about:
:put ([/system clock get time] - [/system clock get gmt-offset ])

Regarding scheduler, it's local time based. You could setup your router with UTC time as a work-around...