Hardware clock is GMT or Locatime?

Greetings,

How can I tell if the hardware clock is using GMT or localtime. In the
program “pi” there is a checkbox that defines this. What does this checkbox
query and what does it update?

Many Thanks,


]{ristoph

Anyone?

“]{ristoph” <news2@kristoph.net> wrote in message
news:9es0n0$8se$1@inn.qnx.com

Greetings,

How can I tell if the hardware clock is using GMT or localtime. In the
program “pi” there is a checkbox that defines this. What does this
checkbox
query and what does it update?

Many Thanks,


]{ristoph

I don’t believe it queries anything. The flag is probably stored in some
config file. It all ends up with ‘rtc’ utility which has ‘-l’ option telling
that hardware clock is in local time. Which means rtc won’t apply TZ offset
to the current time when it is writing it back to hardware. And won’t apply
it when it reads it either so DST won’t switch automatically in this mode.

I suspect ‘pi’ spawns ‘rtc’ because there’s no API to read/write hardware
clock in machine-independent manner.

  • igor

“Kristoph A. Cichocki-Romanov” <news2@kristoph.net> wrote in message
news:9f4n9e$pt5$1@inn.qnx.com

Anyone?

“]{ristoph” <> news2@kristoph.net> > wrote in message
news:9es0n0$8se$> 1@inn.qnx.com> …
Greetings,

How can I tell if the hardware clock is using GMT or localtime. In the
program “pi” there is a checkbox that defines this. What does this
checkbox
query and what does it update?

Many Thanks,


]{ristoph
\

And if you need to figure that from code you could query current time and
save it away, then setenv TZ=gmt00 (it will locally overwrite _CS_TIMEZONE
confstring for your application) in your application, call tzset() and query
current time again. If those 2 times are different (difference should match
value of _CS_TIMEZONE) then hardware must be in GMT, if they are the same
then it is in local. Don’t forget to unset TZ afterwards :wink:

“Igor Kovalenko” <kovalenko@home.com> wrote in message
news:9f4om2$qsl$1@inn.qnx.com

I don’t believe it queries anything. The flag is probably stored in some
config file. It all ends up with ‘rtc’ utility which has ‘-l’ option
telling
that hardware clock is in local time. Which means rtc won’t apply TZ
offset
to the current time when it is writing it back to hardware. And won’t
apply
it when it reads it either so DST won’t switch automatically in this mode.

I suspect ‘pi’ spawns ‘rtc’ because there’s no API to read/write hardware
clock in machine-independent manner.

  • igor

“Kristoph A. Cichocki-Romanov” <> news2@kristoph.net> > wrote in message
news:9f4n9e$pt5$> 1@inn.qnx.com> …
Anyone?

“]{ristoph” <> news2@kristoph.net> > wrote in message
news:9es0n0$8se$> 1@inn.qnx.com> …
Greetings,

How can I tell if the hardware clock is using GMT or localtime. In the
program “pi” there is a checkbox that defines this. What does this
checkbox
query and what does it update?

Many Thanks,


]{ristoph

\