timer with a startat datetime variable in a different time zone

3 Ansichten (letzte 30 Tage)
Damian Maxwell
Damian Maxwell am 7 Okt. 2020
Beantwortet: Seth Furman am 28 Okt. 2020
I would like to schedule a task described in 'dummy_script' at e.g. 8:00 am New York time. I do not live in the US but for convenience (daylight saving changes,...) I would like to use New York time as my reference point for my 'startat' time (trigger1) to make sure it always trigger at 8:00 am NY time.
trigger1 = datetime(2020,10,8,8,00,0,'TimeZone','America/New_York')
This is my simple timer function:
t = timer;
t.TimerFcn = @(~,~) dummy_script1;
startat(t,trigger2)
The only way I can make this work is by defining trigger1 as specified above and then converting it to my local time zone before I use it as a reference point:
trigger2.TimeZone = 'local'
Is there a more elegant way of having Matlab recognise and consider the time zone set for trigger1?

Antworten (1)

Seth Furman
Seth Furman am 28 Okt. 2020
Thank you for reporting this issue. Unfortunately, the startat function currently ignores timezone information when a zoned datetime is provided. I've logged this issue and it may be addressed in a future release. In the meantime, datetime values not in the local timezone will have to be converted to the local timezone before calling startat.

Kategorien

Mehr zu GPU Computing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by