WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ntpclient Blanks Screen  (Read 61698 times)

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: ntpclient Blanks Screen
« Reply #15 on: February 17, 2010, 06:39:48 AM »
For how to use Tiny Core's built time support see:
http://www.gnu.org/software/libtool/manual/libc/TZ-Variable.html

Your BIOS needs to be set UTC not local. You need to use boot code of tz=
See: http://www.tinycorelinux.com/faq.html#timezone

The getTime script accepts a parameter, which should be a local time server in your area. Remaster not necessary.
See: http://tf.nist.gov/tf-cgi/servers.cgi
10+ Years Contributing to Linux Open Source Projects.

Offline vitex

  • Full Member
  • ***
  • Posts: 113
Re: ntpclient Blanks Screen
« Reply #16 on: February 17, 2010, 06:42:41 AM »

The sleep command is used to ensure the network is available before attempting to get the date and time.  I would prefer to replace this with while...   but I don't know what to test for.  Can anyone suggest a valid while command?
 

I use
Code: [Select]
while ! nslookup pool.ntp.org >/dev/null 2>&1 ; do sleep 1 ; done ; sleep 2
to wait for the network to come up before initializing Chrony.  I am not sure that the "sleep 2" is needed.

The Chrony extension has the ability to keep the BIOS hardware clock synchronized to ntp time; that capability is not enabled in the default TC configuration. See the RTC commands in the Chrony documentation http://chrony.tuxfamily.org/manual.html.

Chrony can also be configured to serve ntp time to other computers on the local network.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: ntpclient Blanks Screen
« Reply #17 on: February 17, 2010, 04:42:42 PM »
Isn't it kind of funny that the default DAYTIME server in the getTime.sh script turns out to be hosted by M$?
(see: http://www.robtex.com/ip/131.107.13.100.html)

I'm not suggesting for a moment to change anything, and I'm afraid I'm getting off-topic now ...

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: ntpclient Blanks Screen
« Reply #18 on: February 17, 2010, 11:15:49 PM »
Isn't it kind of funny that the default DAYTIME server in the getTime.sh script turns out to be hosted by M$?
(see: http://www.robtex.com/ip/131.107.13.100.html)

I'm not suggesting for a moment to change anything, and I'm afraid I'm getting off-topic now ...

This is good. Increase their load and leave others free :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #19 on: February 18, 2010, 12:42:32 AM »
Many thanks for the suggested while commands.  I now have one which works as I require.
   

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #20 on: February 18, 2010, 01:55:11 AM »
My objective in this topic is to use a remote timeserver to set the system-time and BIOS time of a local PC in the United Kingdom of Great Britain which uses Daylight Saving Time (DST).

The advice and references you have been good enough to provide have led to some confusion about the use of the bootcode tz.  I would welcome some clarification on this matter.

For how to use Tiny Core's built time support see:
http://www.gnu.org/software/libtool/manual/libc/TZ-Variable.html
Abstracts from the document
Quote
"You should not normally need to set TZ. If the system is configured properly, the default time zone will be correct. You might set TZ if you are using a computer over a network from a different time zone, and would like times reported to you in the time zone local to you, rather than what is local to the computer. "

"In POSIX.1 systems the value of the TZ variable can be in one of three formats. With the GNU C library, the most common format is the last one, which can specify a selection from a large database of time zone information for many regions of the world. The first two formats are used to describe the time zone information directly, which is both more cumbersome and less precise."

"The first format is used when there is no Daylight Saving Time (or summer time) in the local time zone:..."

"The second format is used when there is Daylight Saving Time: ..."

"The third format looks like this:

     :characters

Each operating system interprets this format differently; in the GNU C library, characters is the name of a file which describes the time zone.

If the TZ environment variable does not have a value, the operation chooses a time zone by default. In the GNU C library, the default time zone is like the specification ‘TZ=:/etc/localtime’ (or ‘TZ=:/usr/local/etc/localtime’, depending on how GNU C library was configured; see Installation). Other C libraries use their own rule for choosing the default time zone, so there is little we can say about them. "

Your BIOS needs to be set UTC not local. You need to use boot code of tz=
See: http://www.tinycorelinux.com/faq.html#timezone
Abstract from the document
Quote
"How To Timezone?

If you live where in an area that has DST then you need to use the full specific ation for the tz variable. Indicating both the begin and end of DST.

For example mine tz boot code is: tz=PST+8PDT,M3.2.0/2,M11.1.0/2

In the above DST clause PDT,M3.2.0/2,M11.1.0/2

M3 = month nbr (1-12)
2 = week nbr (1-5)
0 = day of week (0-7)
/2 = time

So for PDT it begins March second Sunday at 2AM and end November first Sunday at 2AM. "

QUESTIONS
01 In light of the the guidance from the gnu manual and roberts, does the bootcode tz=  (I.e. blank) need to be specified?  Is there a difference between using a blank value and not using this bootcode?

02 If the bootcode is required to account for DST in the UK, how is it constructed using the example given in the TC FAQ?  I can understand the month, week, day and time elements but what is the meaning of PST+8PDT?  What are the equivalent values for the UK?

03 As the timezone example given in the TC FAQ corresponds to second format given in the gnu manual is this the only method used by TC?  If so what is seen to be the disadvantage of using "the most common format" - method 3?
   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: ntpclient Blanks Screen
« Reply #21 on: February 18, 2010, 06:06:15 AM »
We use the TZ var because it saves space. If you wish to have DST automatically without having tz set to anything, just grab your timezone file from tzdata.tcz, copy as /etc/localtime, add /etc/localtime to backup.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #22 on: February 18, 2010, 08:37:44 AM »
We use the TZ var because it saves space. If you wish to have DST automatically without having tz set to anything, just grab your timezone file from tzdata.tcz, copy as /etc/localtime, add /etc/localtime to backup.
It is not that I am trying to avoid configuring tz manually, rather it is the difficulty of using the information available to establish a suitable setting. 

A further indication of this is that tzdata.tcz contains no description of what the extension does or how to use it.  This is eased by the guidance you provided in your previous post, without which it would be difficult to use the extension even though it it marked with a status of testing.

Thanks for the advice.
   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: ntpclient Blanks Screen
« Reply #23 on: February 18, 2010, 10:47:11 AM »
It's true that we lack documentation in many areas.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #24 on: February 18, 2010, 11:25:20 AM »
...just grab your timezone file from tzdata.tcz, copy as /etc/localtime, add /etc/localtime to backup.
When this has been done is it then safe to delete /usr/share/zoneinfo and all the files it contains or should tzdata.tcz be uninstalled via Apps Audit?  Uninstalling will presumably also remove the dependencies it installed (bash.tcz and gawk.tcz).  Are these required for use by the timezone file when changing due to Daylight Saving Time triggering?
   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: ntpclient Blanks Screen
« Reply #25 on: February 18, 2010, 12:16:01 PM »
tzdata.tcz can be removed after that. You can keep or remove the dependencies, doesn't matter.
AFAIK nothing special is needed for libc to use that file.

When it's there, all DST changes will be automatic. This is assuming though that the bios clock is set to UTC, as per the linux recommendation.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #26 on: February 20, 2010, 03:59:43 AM »
As a result of the many posts in this thread I thought a summary might be useful.

The objective is to use a remote timeserver to set the system time and date, and BIOS time and date, of a local PC in the United Kingdom of Great Britain which uses Daylight Saving Time (DST).

During testing screen-blanking occurred if the system and BIOS clocks were sufficiently out-of-sync hence the setting of both clocks to counter an unreliable BIOS clock.

  • The bootcode tz= is not used. This allows TC to default to the recommended value of UTC.
  • Daylight Saving Time (DST) is achieved by the use of a timezone file from the extension tzdata.tcz.
  • The system date and time is obtained at each bootup using either the extension ntpclient.tcz or getTime.sh which is provided as a standard TC file.
  • The BIOS date and time is set at each bootup from the system time using hwclock which is a standard TC file.
  • If ntpclient.tcz is used, it is to be installed to ensure it is listed in onboot.lst and thereby loaded at each bootup.
  • tzdata.tcz is installed using On Demand as it is not required to be loaded at each bootup.


SET SYSTEM AND BIOS DATE AND TIME
in /opt/bootlocal.sh

if using ntpclient
Code: [Select]
# Set the system and BIOS date and time
#   Timezone (tz) must be UTC
#   Daylight Saving Time (DST) must be provided by the London timezone file from tzdata.tcz copied as /etc/localtime
while ! nslookup pool.ntp.org &>/dev/null ; do sleep 1 ; done ; ntpclient -s -h pool.ntp.org ; hwclock -w


if using getTime.sh
Code: [Select]
# Set the system and BIOS date and time
#   Timezone (tz) must be UTC
#   Daylight Saving Time (DST) must be provided by the London timezone file from tzdata.tcz copied as /etc/localtime
while ! nslookup time-nw.nist.gov &>/dev/null ; do sleep 1 ; done ; getTime.sh ; hwclock -w


DAYLIGHT SAVING TIME
  • Copy /usr/local/share/zoneinfo/Europe/London   as   /etc/localtime
  • Add /etc/localtime   to   /opt/.filetool.lst   this ensures it is part of your backup
  • Delete tzdata.tz using Apps Audit in the usual way


Create a backup and reboot the PC.
   

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: ntpclient Blanks Screen
« Reply #27 on: February 20, 2010, 06:38:45 PM »
Nice summary, SamK!!

I'd just like to expand a bit on the use of the 'tz' boot code to specify the local time zone (including the provision of daylight saving information). Please note that this is an alternative to copying a file to '/etc/localtime' and not to be used in conjunction with that approach. The following is merely my way of describing what is defined in the first link of Robert reply #15 (see above):

(1) In the case of no daylight saving the boot code simply needs the name of the timezone and the offset to UTC. Example India:
    tz=IST-5:30    i.e. India is 5h30 "ahead" of UTC, AFAIK 'IST' stands for "India Standard Time"

(2) Things get a bit more varied with daylight saving. The TZ definition now also adds the name of the timezone during daylight saving and the details when daylight saving starts and ends. Example France:
    tz=CET-1CEST,M3.5.0,M10.5.0/3  with the following components:
       CET                          timezone name during standard time (i.e. "Central European Time")
          -1                        offset during standard time (i.e. 1h "ahead")
            CEST                    timezone name during daylight saving (i.e. "Central European Summer Time")
                  3                start of daylight saving: the month (i.e. March)
                    5              the week (i.e. last)
                      0            the day (i.e. Sunday)
                         10        end of daylight saving: the month (i.e. October)
                            5      the week (i.e. last)
                              0    the day (i.e. Sunday)
                                3  the time (i.e. 03:00:00)
Please note: Since no time is specified for the start of CEST the default value of 02:00:00 will be used.

I hope this breakdown makes it easier to understand the specification mentioned above. It's actually less intimidating once you got the general idea.

If your are still not keen to create your very own TZ string you can cheat by taking a peek in the (binary) zoneinfo files of the tzdata.tcz extension. Please note that in the following steps (using London as an example) the extension gets merely downloaded (to the home directory), extracted and right away removed again. So nothing remains afterwards. Let's face it, you probably need to find out your local TZ definition only a few times in your life (e.g. when you move or your daylight saving timeframe changes):
Code: [Select]
tc@box:~$ tce-fetch.sh tzdata.tcz
tc@box:~$ mkdir ext
tc@box:~$ sudo mount tzdata.tcz ext -t squashfs -o loop,ro,bs=4096
tc@box:~$ find ext/usr/local/share/zoneinfo -type f -name London | xargs tail -1
GMT0BST,M3.5.0/1,M10.5.0
tc@box:~$ umount ext
tc@box:~$ rm -rf ext tzdata.tcz
If you are not sure about the city to specify in the 'find' command, have a look around the files in the 'zoneinfo' directory (and it's sub-directories) and just use 'tail -1 FILE' for the FILE that best fits your needs.

Offline grisxa

  • Newbie
  • *
  • Posts: 27
Re: ntpclient Blanks Screen
« Reply #28 on: August 11, 2010, 03:15:09 AM »
BTW, Sun Java (I use version 1.6.0-20) doesn't understand such syntax. It only takes first part from $TZ (CET in the example) and omits the daylight saving part. So, i've unset TZ and returned to /etc/localtime file.
Then Java compares /etc/localtime against files in /usr/share/zoneinfo/ and if a match was found it looks for a file with the same name in it's own zoneinfo database - jre/lib/zi/.

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: ntpclient Blanks Screen
« Reply #29 on: June 06, 2011, 01:56:39 AM »
I copied time zone info to wiki

http://wiki.tinycorelinux.net/wiki:time_zone
Many people see what is. Some people see what can be, and make a difference.