• March 28, 2024, 03:16:32 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

This Forum Beta is ONLY for registered owners of D-Link products in the USA for which we have created boards at this time.

Pages: [1] 2 3 4

Author Topic: Correct time during DST  (Read 33834 times)

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Correct time during DST
« on: October 01, 2010, 09:42:10 AM »

Is there any way I can get the correct time during BST without entering the start and end dates?

This is the only system I've owned this decade that doesn't do it automatically ;)

If I set the time manually, it reverts to -1 hour after a reboot.

If I select GMT and enable the time server, it's still an hour out.

Also, what needs to be entered in the DST boxes?

    2010    2011    2012
Clocks go forward   28 March   27 March   25 March
Clocks go back   31 October   30 October   28 October
« Last Edit: January 08, 2013, 08:56:33 AM by FurryNutz »
Logged
If your little 323 is not working right,
You've racked your brains and been up all night
Take a deep breath and wipe away the sweat,
Login as web admin and try a factory reset!

scaramanga

  • Level 2 Member
  • **
  • Posts: 99
Re: Correct time during BST
« Reply #1 on: October 01, 2010, 10:26:30 AM »

Is there any way I can get the correct time during BST without entering the start and end dates?
I'm afraid not. It's not like a standard linux system where all time-zone settings are in /usr/share/zoneinfo and you just need to choose. In the DNS-323's case, it's all hard-coded in /sys/crfs/web_page/tools/timezone.asp. Seems like bad craftsmanship to me.

This is the only system I've owned this decade that doesn't do it automatically ;)
They all need an update from time to time. It's technically possible that such an update would be available for the DNS-323 with a firmware update. How likely is that is anybody's guess.

If I set the time manually, it reverts to -1 hour after a reboot.
Although it's manual, it works for me.

If I select GMT and enable the time server, it's still an hour out.
Did you set the start/end date accordingly?

Also, what needs to be entered in the DST boxes?

    2010    2011    2012
Clocks go forward   28 March   27 March   25 March
Clocks go back   31 October   30 October   28 October
Instead of thinking in clock goes forward/back, see here when DST starts/ends: http://www.timeanddate.com/worldclock/city.html?n=136
You'll have to update that value once a year.
Logged
DNS-323 HW Rev. C1 FW 1.08 fun_plug 0.5
2 x Western Digital WD10EARS-00Y5B1 in Standard mode
(LLC changed to 5 minutes. Partitions aligned to 4K boundary)

chriso

  • Guest
Re: Correct time during BST
« Reply #2 on: October 01, 2010, 02:16:38 PM »

I have always found the automatic time setting for the DNS-323 to be off by any hour.  I could set it manually, but not automatically.

What I do is set it using fun_plug (I'm actually using ffp and set it in fun_plug.local), but it would work in any fun_plug script.

   # Fix time zone information.
echo "Fixed /etc/TZ file"
echo "PST8PDT,M3.2.0,M11.1.0" > /etc/TZ

Logged

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #3 on: October 01, 2010, 02:57:49 PM »

Thanks for the response guys.

chriso, what does the second line of that command actually do?

And can I use something similar to resolve my issue?

Cheers
« Last Edit: October 01, 2010, 03:07:31 PM by jamieburchell »
Logged
If your little 323 is not working right,
You've racked your brains and been up all night
Take a deep breath and wipe away the sweat,
Login as web admin and try a factory reset!

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #4 on: October 01, 2010, 03:12:47 PM »

Did you set the start/end date accordingly?

No, I was hoping that it would be smart enough to know we were in BST and set it to the correct time.

So for start/end for 2010 do I put...

03/28
10/31

?
Logged
If your little 323 is not working right,
You've racked your brains and been up all night
Take a deep breath and wipe away the sweat,
Login as web admin and try a factory reset!

scaramanga

  • Level 2 Member
  • **
  • Posts: 99
Re: Correct time during BST
« Reply #5 on: October 01, 2010, 03:31:44 PM »

?
Pretty much, yes. That "should" do it. Till 2011's day light saving time kicks in, that is.
Logged
DNS-323 HW Rev. C1 FW 1.08 fun_plug 0.5
2 x Western Digital WD10EARS-00Y5B1 in Standard mode
(LLC changed to 5 minutes. Partitions aligned to 4K boundary)

scaramanga

  • Level 2 Member
  • **
  • Posts: 99
Re: Correct time during BST
« Reply #6 on: October 01, 2010, 03:39:31 PM »

chriso, what does the second line of that command actually do?
It overwrites the time zone file with a new value.

And can I use something similar to resolve my issue?
Sure you can. You'll need to learn that time-zone cryptic syntax first. You can read about it here: http://linux.die.net/man/3/tzset. chriso's example used the second format.
« Last Edit: October 01, 2010, 03:42:50 PM by scaramanga »
Logged
DNS-323 HW Rev. C1 FW 1.08 fun_plug 0.5
2 x Western Digital WD10EARS-00Y5B1 in Standard mode
(LLC changed to 5 minutes. Partitions aligned to 4K boundary)

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #7 on: October 01, 2010, 03:44:43 PM »

I'm confused what the difference is between selecting the timezone from the drop-down in the interface, and setting it with this command?

All I want to achieve is the correct time on my NAS automatically all year round :)

I can use fun_plug commands if it will help.

Suggestions?
Logged
If your little 323 is not working right,
You've racked your brains and been up all night
Take a deep breath and wipe away the sweat,
Login as web admin and try a factory reset!

lookingforinfo

  • Guest
Re: Correct time during BST
« Reply #8 on: October 01, 2010, 06:41:31 PM »

I experienced the same problem today.  I think I failed to review the time settings after resetting the unit to Factory Default Settings.  Earlier I enabled NTP Server: and told it to use ntp1.dlink.com.  After reading these comments I, rebooted the 323 and the time is being reported correctly.  System is at FW 1.08.
Logged

chriso

  • Guest
Re: Correct time during BST
« Reply #9 on: October 01, 2010, 09:53:37 PM »

The reason that time on the DNS-323 is wrong is because it is being handled fundamentally wrong.   Also most anything you image to do wrong with time the DNS-323 does it.

First off the way time settings on a Unix/Linux box are suppose to be done is that what is set in the /etc/TZ file is the name of the timezone, which is then looked up in the /usr/share/timezone database to find the exact rules of when to have daylight saving time or not.  Problem is there is no /usr/share/timezone database on the DNS-323, so they resort to a syntax like: GMT+8.  The problem with this is that it relies on the rule compiled into the OS, but they the rules can change and have just recently (a couple years ago for lots of parts of the world).  So the DNS-323 changes to/from daylight saving time on the wrong dates/time.

The people at D-Link figured they will put in the date boxes for which date you should change on.  There is a few problems with this, but the main problem is that is not what the rules of daylight saving time says.  It isn't a date, it is stated as the first Sunday in X month and ending in the last Sunday of Y month.  So if you set a date that is correct for this year you are guaranteed to be wrong for next year.
The other thing that could be wrong is the time of day to change.  Most use 2 am, but it doesn't have to be.

Some might think that turning on the NTP Server that it would fix the problem.  Not so.  The purpose of the NTP server is to go out to the server and ask it the time and set the system time using it, but this was meant to correct being off by a few seconds (to correct for drifting clocks, which the DNS-323 has).  If your time is off by an hour, the method it uses to sync would take days, but most likely actually it will just give up because it is to far off.  It uses this slow correction because changing the time around quickly can confuse programs that depending on reading the time and doing something.  Another thing to realize is that the NTP servers can be on the other side of the world so they don't know what timezone or if you are suppose to be in daylight time or not.  It is up to the computer to be setup correctly to know these things.  The NTP always just reports GMT with no daylight saving time.

Luckily there is an extended format for the entry in /etc/TZ that allows you to tell the system the correct rules.
In the case of US Pacific time that entry is:
PST8PDT,M3.2.0,M11.1.0

This is read. PST (abbreviation for Pacific Standard Time), 8 the number of hours from GMT, which can be 0 or negative, I know of no syntax for those weird countries that choose to have a 1/2 hour timezone, PDT (abbreviation for Pacific Daylight Time), the "M" entries give the starting/ending month.week.day.
Month is what you expect.  January is 1, February is 2, ... So the first month in mine is March.
Next comes the week.  This is week 1, week 2, ... (up to 5 since you can have a 5th week in a month).  So for my first entry has it changing on the second week in March.  The last is the day.  The days are Sunday which is 0, Monday 1, ...  So my entry is on the Sunday of the second week of March change.  So the ending date reads On the Sunday of the first week November change back.  There is also a format for the time of day to change, the default is 2 am, which the US uses so I didn't include it, but you can see it used below in the BST example.

What is it for BST?  This timezone changes at 1 am, and time would be given with the /1
I grabbed the following rules from this link:
http://wwp.britishsummertime.co.uk/
    *  Starts: Last Sunday in March
    * End: Last Sunday in October
    * Time: 1.00 am (01:00) Greenwich Mean Time (GMT)

BST0BDT,M3.5.0/1,M10.5.0/1

NOTES:
   * I don't live in BST timezone so this example is just going by the rules not my personal experience that it changes when people expect.
    * But the for my timezone listed above (Pacific) I have lived with this setting for about 2 1/2 years and my time is always correct.
    * I notice that the DNS-323 will not allow you to set the "Daylight Savings" flag without filling in the dates.  Well the setting in the /etc/TZ is doing overrides this and even the first setting that picks the timezone, so it doesn't matter what it is set to.  You do want to set the timezone right just so on the DNS-323 GUI is shows it right.
   * If you change the timezone/Daylight/Dates it will override what is in the TZ file until you reboot and the fun_plug script changes it back.
   * This link has a good explanation of the /etc/TZ format: http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html
    * I have had problems with the built in NTP server not syncing some times, and have switched to running it through the ntpd.sh script in the ffp scripts.  That allows me to tweak it for starting it in "burst" mode, using backup servers, and retrying on errors.  But this is only good information if you are using the ffp fun_plug scripts.
« Last Edit: October 01, 2010, 10:06:15 PM by chriso »
Logged

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #10 on: October 02, 2010, 02:08:50 AM »

Wow. Thank you for taking the time to explain that so well. I've definitely learned from your post and am happy to say the command is working!
Logged
If your little 323 is not working right,
You've racked your brains and been up all night
Take a deep breath and wipe away the sweat,
Login as web admin and try a factory reset!

affinity

  • Guest
Re: Correct time during BST
« Reply #11 on: October 05, 2010, 10:14:01 AM »

The reason that time on the DNS-323 is wrong is because it is being handled fundamentally wrong.   Also most anything you image to do wrong with time the DNS-323 does it.
Fantastic explanation, thank you very much.

Now here in Melbourne, we have "early" daylight savings and that is causing me havoc with jobs scheduled with "at" -- the web gui time is an hour out, but with my new /etc/TZ file, date in a putty session now gives the right time!  I've scripted getting current time via "ssh $server /bin/date" previously as a work around.

Anyway, with this new TZ file [shown below if anyone else in Melbourne, AU needs it] ... am I going to be past the problems of the at scheduler?  Or will it still cause more hassle?

Thanks again.
AndrewM

Melbourne, VIC, AU /etc/TZ file:
Code: [Select]
EST-10EST,M10.1.0,M4.1.0/3
btw I actually got that string from a Debian box using the following:
Code: [Select]
tail -1 /etc/localtime
Logged

barryware

  • Level 1 Member
  • *
  • Posts: 19
Re: Correct time during BST
« Reply #12 on: October 05, 2010, 10:23:34 AM »

Just chiming in to say that the DST setup having to specify the dates is silly.

In the US.. dst starts the 2nd sunday of march and ends the 1st sunday of november. Sunday dates change from year to year.

dd-wrt (open source linux router firmware).. that is how you select dst.. days of the week & months.. not dates.
Logged

gunrunnerjohn

  • Level 11 Member
  • *
  • Posts: 2717
Re: Correct time during BST
« Reply #13 on: October 05, 2010, 11:12:59 AM »

Most other Linux based products have no problem with DST calculations.  This is just one of a number of oddities and poor design decisions in the D-Link NAS boxes.
Logged
Microsoft MVP - Windows Desktop Experience
Remember: Data you don't have two copies of is data you don't care about!
PS: RAID of any level is NOT a second copy.

affinity

  • Guest
Re: Correct time during BST
« Reply #14 on: October 05, 2010, 05:34:20 PM »

:(

Still got "at" scheduler issues, jobs re-spawning ... it's driving me nuts atm.
Logged
Pages: [1] 2 3 4