• November 13, 2019, 01:05:10 AM
  • 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 30169 times)

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #15 on: October 06, 2010, 12:14:25 AM »

I would point out that there is no substitute for actual support.  It doesn't matter if you are talking about compiled in rules in the OS or the timezone database or the TZ file (Or the Java database for time for that matter).  Countries change their timezones all the time, and the only way for them to be correct is that whatever time data/rules are being used is updated.  With an OS like Unix/Linux/Windows you are getting a constant set of updates.  And so these daylight saving times rules are just part of that.  If you kept your Windows/Linux/Unix box off the Internet or didn't allow any updates they would be wrong when your country changed its rules they would be wrong too.

No magic here.
Logged

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #16 on: November 16, 2010, 02:12:10 PM »

Code: [Select]
echo "BST0BDT,M3.5.0/1,M10.5.0/1" > /etc/TZ
Although the above has correctly set my time, I've noticed the NAS is still reporting the zone to be BST and not GMT now we are out of BST. Not critical, but how can this be fixed?
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!

dosborne

  • Level 5 Member
  • *****
  • Posts: 598
Re: Correct time during BST
« Reply #17 on: November 16, 2010, 05:15:51 PM »

My understanding is that string should produce a TZ of BST or BDT depending on the date.
Logged
3 x DNS-323 with 2 x 2TB WD Drives each for a total of 12 TB Storage and Backup. Running DLink Firmware v1.08 and Fonz Fun Plug (FFP) v0.5 for improved software support.

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #18 on: November 17, 2010, 01:04:01 AM »

I found out that along with the problem of /etc/TZ needing to be set there are a few of programs that run from cron that mess up the correct time too.

Here is my corrections, if you use it make sure you use the right setting for your location for /etc/TZ
   # Fix time zone information.
crontab -l | grep -vi rtc | grep -vi stime | grep -vi daylight > /tmp/cron.tmp
crontab /tmp/cron.tmp
echo "PST8PDT,M3.2.0,M11.1.0" > /etc/TZ
echo "Fixed /etc/TZ file"
Logged

lookingforinfo

  • Guest
Re: Correct time during BST
« Reply #19 on: November 17, 2010, 12:37:37 PM »

I am sorry if this question is too basic, but it is related to having the 323 use the correct time.

As I said previously, I have enabled NTP server but have not advanced to using ffp.  Initially this seemed to work.  It now appears that the unit only checks the NTP server when I select "Save Settings" on the TOOLS page.  Having super accurate time is not essential, however I would like to confirm what must be done to keep the time generally correct.  I had previously thought the time check might occur after a sleep period.
Logged

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #20 on: November 17, 2010, 04:02:55 PM »

Code: [Select]
echo "BST0BDT,M3.5.0/1,M10.5.0/1" > /etc/TZ
Although the above has correctly set my time, I've noticed the NAS is still reporting the zone to be BST and not GMT now we are out of BST. Not critical, but how can this be fixed?

You are in BST, which happens to be GMT, what you came out of was BDT (daylight savings time ended).  If you don't like it saying BST then use:
Code: [Select]
echo "GMT0BDT,M3.5.0/1,M10.5.0/1" > /etc/TZ
« Last Edit: November 17, 2010, 04:19:44 PM by chriso »
Logged

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #21 on: November 17, 2010, 04:15:05 PM »

I am sorry if this question is too basic, but it is related to having the 323 use the correct time.

As I said previously, I have enabled NTP server but have not advanced to using ffp.  Initially this seemed to work.  It now appears that the unit only checks the NTP server when I select "Save Settings" on the TOOLS page.  Having super accurate time is not essential, however I would like to confirm what must be done to keep the time generally correct.  I had previously thought the time check might occur after a sleep period.

What you are seeing is basically what I have seen too.  I dumped the built in for the one in ffp, and even tweaked it a bit.  Where is my ffp/start/ntpd.sh
Code: [Select]
#!/ffp/bin/sh

# PROVIDE: ntpd
# REQUIRE: SERVERS
# BEFORE: LOGIN

. /ffp/etc/ffp.subr

name="ntpd"
command="/ffp/bin/ntpd"
ntpd_flags="-g -f /ffp/etc/ntp.drift"
required_files="/ffp/etc/ntp.conf"
start_cmd="ntpd_start"

ntpd_start()
{
# fix /etc/services
if ! grep -w ntp /etc/services >/dev/null; then
echo "ntp 123/udp" >>/etc/services
fi

# remove rtc and daylight cron jobs
crontab -l | grep -vw '/usr/sbin/daylight' | grep -vw '/usr/sbin/rtc' | crontab -

# Make sure the system clock is correct at start up.
ntpdate -b -u 0.us.pool.ntp.org
if [ $? -ne 0 ] ; then
echo "Sleeping 10 seconds"
sleep 10
ntpdate -b -u 0.us.pool.ntp.org
fi

proc_start $command           
}

run_rc_command "$1"

And my ffp/etc/ntp.conf (This will be different if you are not in the US).
Code: [Select]
# US time servers, iburst to speed up synchronization on startup
#server us.pool.ntp.org iburst
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org

# drift file path is passed on command line in ntpd.sh (-f)
# driftfile /etc/ntp.drift

# add local clock with stratum 10 as last resort
server 127.127.1.0
fudge  127.127.1.0 stratum 10

# detailed logging
#logconfig =all
Logged

lookingforinfo

  • Guest
Re: Correct time during BST
« Reply #22 on: November 17, 2010, 07:34:44 PM »

Thank you for the additional information and confirmation.  At the current point in time I am trying to make my life more simple and would like to not utilize ffp, if at all possible.

I doubt that this will be fixed by D-Link, but do hope others will recognize the limitations when they enable NTP server.
Logged

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #23 on: November 18, 2010, 03:33:51 AM »

You are in BST, which happens to be GMT, what you came out of was BDT (daylight savings time ended).  If you don't like it saying BST then use:
Code: [Select]
echo "GMT0BDT,M3.5.0/1,M10.5.0/1" > /etc/TZ

My understanding is that BST = British Summer Time. It's clear to see from looking out of the window it's not summer anymore :)

Never heard of "BDT" before.

GMT = Greenwich Mean Time. Greenwich is in the UK.
« Last Edit: November 19, 2010, 02:37:19 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!

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #24 on: November 18, 2010, 04:52:31 PM »

BST if it follows the rest of the world is British Standard Time, and BDT is British Daylight Time.
For instance my time Pacific Standard Time (PST), and Pacific Daylight Time (PDT).

But like I said if you want some other three letter abbreviations feel free to use them.
Logged

dosborne

  • Level 5 Member
  • *****
  • Posts: 598
Re: Correct time during BST
« Reply #25 on: November 18, 2010, 05:57:29 PM »

BST if it follows the rest of the world is British Standard Time, and BDT is British Daylight Time.
It does not. BST is British Summer Time. The compliment is GMT, Greenwich Mean Time. BST = GMT+1

British Standard Time was an expirement in the '60s where the time was advanced an hour all year long and was discontinued after a couple of years.
Logged
3 x DNS-323 with 2 x 2TB WD Drives each for a total of 12 TB Storage and Backup. Running DLink Firmware v1.08 and Fonz Fun Plug (FFP) v0.5 for improved software support.

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #26 on: November 18, 2010, 10:17:45 PM »

Sounds like you want
Code: [Select]
echo "GMT0BST,M3.5.0/1,M10.5.0/1" > /etc/TZ
Logged

jamieburchell

  • Level 6 Member
  • *
  • Posts: 947
Re: Correct time during BST
« Reply #27 on: November 19, 2010, 02:38:40 PM »

Sounds like you want
Code: [Select]
echo "GMT0BST,M3.5.0/1,M10.5.0/1" > /etc/TZ

Thanks chriso, that's perfect.
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 #28 on: March 29, 2011, 01:29:28 AM »

Something's still not right here. We've just entered BST as of Sunday, but my NAS's time didn't move an hour forward. So I changed it manually. This morning I've checked and the time has gone back an hour again.

I've got a cron job that runs every few hours, and it spits out the current time, looking at it - something's amiss when you consider the flicking between UTC, GMT and BST:

Checking SMART status on SDA at Sat Mar 26 08:00:01 UTC 2011...
Checking SMART status on SDB at Sat Mar 26 08:00:06 UTC 2011...
Checking SMART status on SDA at Sat Mar 26 14:00:01 GMT 2011...
Checking SMART status on SDB at Sat Mar 26 14:01:03 GMT 2011...
Checking SMART status on SDA at Sat Mar 26 20:00:01 GMT 2011...
Checking SMART status on SDB at Sat Mar 26 20:00:06 GMT 2011...
Checking SMART status on SDA at Sun Mar 27 02:00:00 BST 2011...
Checking SMART status on SDB at Sun Mar 27 02:00:05 BST 2011...
Checking SMART status on SDA at Sun Mar 27 08:00:01 BST 2011...
Checking SMART status on SDB at Sun Mar 27 08:00:06 BST 2011...
Checking SMART status on SDA at Sun Mar 27 14:00:00 BST 2011...
Checking SMART status on SDB at Sun Mar 27 14:00:05 BST 2011...
Checking SMART status on SDA at Sun Mar 27 20:00:01 BST 2011...
Checking SMART status on SDB at Sun Mar 27 20:00:06 BST 2011...
Checking SMART status on SDA at Mon Mar 28 02:00:01 UTC 2011...
Checking SMART status on SDB at Mon Mar 28 02:00:06 UTC 2011...
Checking SMART status on SDA at Mon Mar 28 08:00:01 UTC 2011...
Checking SMART status on SDB at Mon Mar 28 08:00:06 UTC 2011...
Checking SMART status on SDA at Mon Mar 28 14:00:00 GMT 2011...
Checking SMART status on SDB at Mon Mar 28 14:00:05 GMT 2011...
Checking SMART status on SDA at Mon Mar 28 20:00:01 GMT 2011...
Checking SMART status on SDB at Mon Mar 28 20:00:06 GMT 2011...
Checking SMART status on SDA at Tue Mar 29 02:00:01 GMT 2011...
Checking SMART status on SDB at Tue Mar 29 02:00:06 GMT 2011...
Checking SMART status on SDA at Tue Mar 29 08:00:01 GMT 2011...
Checking SMART status on SDB at Tue Mar 29 08:00:06 GMT 2011...
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!

chriso

  • Level 2 Member
  • **
  • Posts: 54
Re: Correct time during BST
« Reply #29 on: March 29, 2011, 05:03:11 PM »

With your logs and such what is happening is that some thing (or things) are resetting your time.
Do you have the NTP server enabled on the DNS-323?  The first thing is to make sure it is off, but that might not be enough and if you don't have another NTP server on it might drift with time.

As a test I just put echo "GMT0BST,M3.5.0/1,M10.5.0/1" > /etc/TZ
Into my DNS-323 and got the right time for BST.

This should be case for any time zone, you should be able to switch the /etc/TZ entry and it switches to the right time.  The reason is because the real time should be stored and maintained as GMT time in the system clock no matter where you are in the world or whether it is daylight savings time or not.  The /etc/TZ just tells it what to display as the time you want to see.

Since I found the whole time setup to be wrong on the DNS-323 I have done the following:
1) Disable NTP Server on DNS-323
2) At start up from in ffp/etc/fun_plug.local  :
Code: [Select]
   # Fix time zone information.
   # remove rtc and daylight cron jobs
crontab -l | grep -vi rtc | grep -vi stime | grep -vi daylight | crontab -
echo "PST8PDT,M3.2.0,M11.1.0" > /etc/TZ
echo "Fixed /etc/TZ file"

Basically kill anything that the DNS-323 does to change the time and then set the correct TZ value.

And then I go on to run a good NTP server from ffp, with my own tweak to make sure it sets to the right time on boot (and I notice I  remove the programs above from the crontab here again, most likely not needed in both places).

ffp/start/ntpd.sh
Code: [Select]
#!/ffp/bin/sh

# PROVIDE: ntpd
# REQUIRE: SERVERS
# BEFORE: LOGIN

. /ffp/etc/ffp.subr

name="ntpd"
command="/ffp/bin/ntpd"
ntpd_flags="-g -f /ffp/etc/ntp.drift"
required_files="/ffp/etc/ntp.conf"
start_cmd="ntpd_start"

ntpd_start()
{
# fix /etc/services
if ! grep -w ntp /etc/services >/dev/null; then
echo "ntp 123/udp" >>/etc/services
fi

# remove rtc and daylight cron jobs
crontab -l | grep -vw '/usr/sbin/daylight' | grep -vw '/usr/sbin/rtc' | crontab -

# Make sure the system clock is correct at start up.
ntpdate -b -u 0.us.pool.ntp.org
if [ $? -ne 0 ] ; then
echo "Sleeping 10 seconds"
sleep 10
ntpdate -b -u 0.us.pool.ntp.org
fi

proc_start $command           
}

run_rc_command "$1

ffp/etc/ntp.conf
Code: [Select]
# US time servers, iburst to speed up synchronization on startup
#server us.pool.ntp.org iburst
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org

# drift file path is passed on command line in ntpd.sh (-f)
# driftfile /etc/ntp.drift

# add local clock with stratum 10 as last resort
server 127.127.1.0
fudge  127.127.1.0 stratum 10

# detailed logging
#logconfig =all
Logged
Pages: 1 [2] 3 4