1
Im currently designing a solution to synchronize a Clock on a Equipment. Each time the Equipment is turned on after a poweroff, its Clock is exactly "01:01". To sync this Equipment, I have a NEXA remote switch and a Telldus duo. The Telldus duo is connected to a server which is a NTP server with GPS and PPS source.
Now to the problem: Currently, the Clock synchronizes by simply turning off Power scheduled at 01:00, and then turning on Power 01:01, causing the Clock on the Equipment to Always go correct.
But the problem is on DST change Days. If there is a DST change day that says the Clock should be moved FORWARD 1 hour at 02:00 to 03:00, then the Clock on the Equipment will be behind by 1 hour in one full day. If there is a DST change day that says the Clock should be moved BACK 1 hour, then the equpment will be running 1 hour too fast.
Thus, on the DST FORWARD Days, I need to Schedule the Equipment to turn off at 00:00 and turn on at 00:01. Then the Equipment will be 01:01 when Clock is 00:01. When Clock is 02:00 and is changed to 03:00, then Equipment will already be at 03:00, thus Equipment will only have incorrect Clock for 2 hour.
And on the DST BACK Days, I need to Schedule the Equipment to turn off at 02:00 and turn on at 02:01. Thus the Equipment will be 02:00 when Clock is 03:00 and being DST'ed back to 02:00, thus in this case Equipment's Clock will only be incorrect for 1 hour.
I have the full capatibility to write a script that will accomplish this, GIVEN THAT:
I know a command, that can tell me, if TODAY is the day that a DST change will occur, and in which direction (02:00 to 03:00, or 03:00 to 02:00) it will occur.
This means I need either some dedicated DST command, OR a possibility to "look in the future", like "What is the Clock when 4 hours have elapsed from now, accounting for DST?". (Then I could check, if the difference between now and returned clock is 3 hours, then its a DST-BACK day, 4 hours, then its a NO-DST day and 5 hours then its a DST-FORWARD day)
Anyone that have a idea of such command?
nice command! But took a pretty long time to execute. Adding -c $(date '+%Y'),$(date -d '+1 year' '+%Y') to the zdump command solved this problem. (had to read the zdump manual. Didnt even know Zdump existed) – sebastian nielsen – 2014-08-30T23:26:39.990
True - your changes brought it down from 0.7s to 0.01s for me. I'll edit my post.
zdump
manual? Mine doesn't have one :-( – garethTheRed – 2014-08-31T07:16:46.617