Re: [Soekris] Clock losing time on Net5501

2013-02-14 Thread Greg Troxel

Stuart Henderson  writes:

> So, in theory, this should force it to be written:
>
> # date $(date +%Y%m%d%H%M.%S)

Yes, but that will set fractional seconds to zero.  You probably want a
C program that does gettimeofday()/settimeofday()>


pgp5eB7CUHWfC.pgp
Description: PGP signature
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-14 Thread Stuart Henderson
On 2013-02-13, Christian Weisgerber  wrote:
> Joakim Aronius  wrote:
>
> [OpenBSD]
>> I have not had time to look into the 'new' rc.d controlsystem for
>> starting and stopping services but a cronjob with '/etc/rc.d/ntpd
>> restart' should do the same thing as a reboot.. But I could not find
>> anything on special handling like writing hw clock during shutdown,
>> could be internal in ntpd.
>
> ntpd(8) doesn't have anything to do with it.  The hardware clock
> is set by the boot(9) call when halting/rebooting the system.
>
> settimeofday(2) and clock_settime(2) will also set the hardware
> clock.  However, only "ntpd -s" calls settimeofday, once at startup.
> In normal operation, ntpd uses adjtime(2), which does not touch the
> hardware clock.

So, in theory, this should force it to be written:

# date $(date +%Y%m%d%H%M.%S)

___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Christian Weisgerber
Joakim Aronius  wrote:

[OpenBSD]
> I have not had time to look into the 'new' rc.d controlsystem for
> starting and stopping services but a cronjob with '/etc/rc.d/ntpd
> restart' should do the same thing as a reboot.. But I could not find
> anything on special handling like writing hw clock during shutdown,
> could be internal in ntpd.

ntpd(8) doesn't have anything to do with it.  The hardware clock
is set by the boot(9) call when halting/rebooting the system.

settimeofday(2) and clock_settime(2) will also set the hardware
clock.  However, only "ntpd -s" calls settimeofday, once at startup.
In normal operation, ntpd uses adjtime(2), which does not touch the
hardware clock.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Peter J. Holzer
On 2013-02-13 07:35:36 -0500, Greg Troxel wrote:
> 
> Lars Noodén  writes:
> 
> > Yes, I figured out that hardclock(9) was not a command.  What the
> > solution looks like, is that OpenBSD sets the hardware clock during a
> > proper shutdown or reboot.  That was not something I did often and over
> > the months the clock drifted.  However, I was not able to find anything
> > about the hardware clock in boot(8), reboot(8), or shutdown(8).
> 
> I'm not sure why OpenBSD only sets the hw clock during shutdown.  I get
> it that in theory a clean shutdown will happen, but it would seem
> sensible to set it often enough while up.  I'm not sure how disruptive
> that is, though.  So you might read the kernel code, possibly implement
> a callout to do it every 24h.  But really this should be brought up on
> the OpenBSD kernel lists.

The Linux kernel updates the hardware clock once per hour iff the
software system clock is synchronized. Or at least it did this when I
last looked at the code, which was several years ago. That should be
often enough to always keep the hw clock accurate within a second or so
but consume negligible resources (accessing the hw clock is slow, but
not that slow).

hp


-- 
   _  | Peter J. Holzer| Auf jedem Computer sollte der Satz Ludwigs II
|_|_) | Sysadmin WSR   | eingeprägt stehen: "Ein ewig Rätsel will ich
| |   | h...@wsr.ac.at  | bleiben, mir und andern."
__/   | http://www.hjp.at/ |-- Wolfram Heinrich in desd


signature.asc
Description: Digital signature
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Greg Troxel

Lars Noodén  writes:

> Yes, I figured out that hardclock(9) was not a command.  What the
> solution looks like, is that OpenBSD sets the hardware clock during a
> proper shutdown or reboot.  That was not something I did often and over
> the months the clock drifted.  However, I was not able to find anything
> about the hardware clock in boot(8), reboot(8), or shutdown(8).

I'm not sure why OpenBSD only sets the hw clock during shutdown.  I get
it that in theory a clean shutdown will happen, but it would seem
sensible to set it often enough while up.  I'm not sure how disruptive
that is, though.  So you might read the kernel code, possibly implement
a callout to do it every 24h.  But really this should be brought up on
the OpenBSD kernel lists.

I use NetBSD, and I am actually not sure of how the hwclock is handled.
But I have not noticed the large drift issue.

Assuming this has not diverged from NetBSD, look for resettodr() in the
kernel.  NetBSD calls this when setting time.  It also calls it on
shutdown (on i386; this is MD).  But it doesn't seem to call it
periodically.



pgpP_NerACQna.pgp
Description: PGP signature
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Joakim Aronius
* Lars Noodén (lars.noo...@gmail.com) wrote:
> Yes, I figured out that hardclock(9) was not a command.  What the
> solution looks like, is that OpenBSD sets the hardware clock during a
> proper shutdown or reboot.  That was not something I did often and over
> the months the clock drifted.  However, I was not able to find anything
> about the hardware clock in boot(8), reboot(8), or shutdown(8).
> 
> The drift is smaller now with proper shutdowns:
> 
>  Feb 10 11:41:11 net5501 ntpd[27063]: adjusting local clock by 0.566889s
>  Feb 11 10:39:33 net5501 ntpd[223]: adjusting local clock by 0.532332s
>  Feb 11 10:40:06 net5501 ntpd[223]: adjusting local clock by 0.367435s
>  Feb 12 09:58:31 net5501 ntpd[4051]: adjusting local clock by 0.358181s
>  Feb 12 14:16:11 net5501 ntpd[22600]: adjusting local clock by 0.491998s
>  Feb 13 11:06:42 net5501 ntpd[16119]: adjusting local clock by 0.165717s
> 
> I've been using the soekris like an appliance and something of that
> needs to change to keep the clock accuracy.  Perhaps a scheduled reboot
> mid-day or an extra cycle at startup might be the answer.  Or I could
> just go back to launching ntpd with -s to set the time immediately on
> startup -- after the external network becomes available.

I have not had time to look into the 'new' rc.d controlsystem for starting and 
stopping services but a cronjob with '/etc/rc.d/ntpd restart' should do the 
same thing as a reboot.. But I could not find anything on special handling like 
writing hw clock during shutdown, could be internal in ntpd. But I do find this 
strange, i.e. hw clock should be updated often enough to not be too much out of 
sync after a crash..

BR
/Joakim 
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Lars Noodén
On 02/13/2013 01:54 PM, Joakim Aronius wrote:
> * Hendrickson, Kenneth (khend...@harris.com) wrote:
>> --- Lars Noodén wrote:
>>> but can't find a binary or man page.
>>
>> Here is a link to the man page for OpenBSD's hardclock(9):
>> http://www.openbsd.org/cgi-bin/man.cgi?query=hardclock&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html
> 
> This is not a CLI command. I think ntpd updates the 'hwclock' automatically 
> but Im not sure if
there is a difference for controlled and uncontrolled shutdowns, Send a
question to m...@openbsd.org.
> 
> /Joakim
> 
Yes, I figured out that hardclock(9) was not a command.  What the
solution looks like, is that OpenBSD sets the hardware clock during a
proper shutdown or reboot.  That was not something I did often and over
the months the clock drifted.  However, I was not able to find anything
about the hardware clock in boot(8), reboot(8), or shutdown(8).

The drift is smaller now with proper shutdowns:

 Feb 10 11:41:11 net5501 ntpd[27063]: adjusting local clock by 0.566889s
 Feb 11 10:39:33 net5501 ntpd[223]: adjusting local clock by 0.532332s
 Feb 11 10:40:06 net5501 ntpd[223]: adjusting local clock by 0.367435s
 Feb 12 09:58:31 net5501 ntpd[4051]: adjusting local clock by 0.358181s
 Feb 12 14:16:11 net5501 ntpd[22600]: adjusting local clock by 0.491998s
 Feb 13 11:06:42 net5501 ntpd[16119]: adjusting local clock by 0.165717s

I've been using the soekris like an appliance and something of that
needs to change to keep the clock accuracy.  Perhaps a scheduled reboot
mid-day or an extra cycle at startup might be the answer.  Or I could
just go back to launching ntpd with -s to set the time immediately on
startup -- after the external network becomes available.

Regards,
/Lars
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-13 Thread Joakim Aronius
* Hendrickson, Kenneth (khend...@harris.com) wrote:
> --- Lars Noodén wrote:
> > but can't find a binary or man page.
> 
> Here is a link to the man page for OpenBSD's hardclock(9):
> http://www.openbsd.org/cgi-bin/man.cgi?query=hardclock&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html

This is not a CLI command. I think ntpd updates the 'hwclock' automatically but 
Im not sure if there is a difference for controlled and uncontrolled shutdowns, 
Send a question to m...@openbsd.org. 

/Joakim
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Hendrickson, Kenneth
--- Lars Noodén wrote:
> but can't find a binary or man page.

Here is a link to the man page for OpenBSD's hardclock(9):
http://www.openbsd.org/cgi-bin/man.cgi?query=hardclock&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html

Ken


___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Lars Noodén
On 02/05/2013 10:13 PM, Matt Lawrence wrote:
> On Tue, 5 Feb 2013, Lars Noodén wrote:
> 
>> Yes, I've recently started launching ntpd with -s to avoid the
>> incremental adjustments.  Without -s, it takes all day to catch up,
>> usually 5 or so hours.  I'm concerned that the clock is off by so much
>> at cold boot.
> 
> After the system time is brought back into sync are you resetting the 
> hardware clock?  See the hwclock command.

It's running OpenBSD 5.2-stable.  There's not the exact command
'hwclock'.  Perhaps there is an OpenBSD analog.  I'm finding this with
'apropos':

hardclock (9) - real-time system clock

but can't find a binary or man page.

/Lars
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Matt Lawrence
On Tue, 5 Feb 2013, Lars Noodén wrote:

> Yes, I've recently started launching ntpd with -s to avoid the
> incremental adjustments.  Without -s, it takes all day to catch up,
> usually 5 or so hours.  I'm concerned that the clock is off by so much
> at cold boot.

After the system time is brought back into sync are you resetting the 
hardware clock?  See the hwclock command.

-- Matt
It's not what I know that counts.
It's what I can remember in time to use.
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Lars Noodén
On 02/05/2013 09:26 PM, Chris Cappuccio wrote:
> Lars Nood?n [lars.noo...@gmail.com] wrote:
>> On 02/05/2013 01:54 PM, Soren Kristensen wrote:
>>> Hi Lars,
>>>
>>> Lars Nood?n wrote:
 I have a Net5501 that seems to be losing > 90 seconds off the system
 clock when it is turned off for a while.  Is there anything that can or
 should be done to fix this?
>>>
>>> That need to be qualified with time to be able to say if it's out of
>>> spec
>>
>> Thanks.  How would I check that?  I have ntpd starting with to set the
>> time immediately at startup.  But without that, I get log entries like
>> these:
>>
>> Feb  1 08:43:33 net5501 ntpd[30196]: adjusting local clock by 94.899672s
>>
>> Am I interpreting that correctly?
>>
> 
> Do you start ntpd with -s? If not, it continually adjusts the clock to bring 
> it up to current time, in relatively small increments.
> 
Yes, I've recently started launching ntpd with -s to avoid the
incremental adjustments.  Without -s, it takes all day to catch up,
usually 5 or so hours.  I'm concerned that the clock is off by so much
at cold boot.

Regards,
/Lars
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Chris Cappuccio
Lars Nood?n [lars.noo...@gmail.com] wrote:
> On 02/05/2013 01:54 PM, Soren Kristensen wrote:
> > Hi Lars,
> >
> > Lars Nood?n wrote:
> >> I have a Net5501 that seems to be losing > 90 seconds off the system
> >> clock when it is turned off for a while.  Is there anything that can or
> >> should be done to fix this?
> >
> > That need to be qualified with time to be able to say if it's out of
> > spec
> 
> Thanks.  How would I check that?  I have ntpd starting with to set the
> time immediately at startup.  But without that, I get log entries like
> these:
> 
> Feb  1 08:43:33 net5501 ntpd[30196]: adjusting local clock by 94.899672s
> 
> Am I interpreting that correctly?
> 

Do you start ntpd with -s? If not, it continually adjusts the clock to bring it 
up to current time, in relatively small increments.
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Lars Noodén
On 02/05/2013 01:54 PM, Soren Kristensen wrote:
> Hi Lars,
>
> Lars Noodén wrote:
>> I have a Net5501 that seems to be losing > 90 seconds off the system
>> clock when it is turned off for a while.  Is there anything that can or
>> should be done to fix this?
>
> That need to be qualified with time to be able to say if it's out of
> spec

Thanks.  How would I check that?  I have ntpd starting with to set the
time immediately at startup.  But without that, I get log entries like
these:

Feb  1 08:43:33 net5501 ntpd[30196]: adjusting local clock by 94.899672s

Am I interpreting that correctly?

Regards,
/Lars

>> I see that there are others with the same problem:
>>
>> http://lists.soekris.com/pipermail/soekris-tech/2010-July/016691.html
>>
>> I guess the batteries are only good for 3 or so years and now it has to
>> be replaced with a new Panasonic ML1220/V1AE [1]  Digikey is recommended
>> there, is there another supplier that is withing the Euro zone?  Also,
>> how likely is it that someone with middling soldering skills can do the
>> replacement?
>
> The batteries are supposed to be last minimum 10 years, typecial 20
> years. They're rechargeable, but a charge last only 1-2 months.
>
> But is the RTC still works then the batteri is fine.
>
>
> Best Regards,
>
>
> Soren Kristensen
>
> CEO & Chief Engineer
> Soekris Engineering, Inc.
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Lars Noodén
On 02/05/2013 01:54 PM, Soren Kristensen wrote:
> Hi Lars,
> 
> Lars Noodén wrote:
>> I have a Net5501 that seems to be losing > 90 seconds off the system
>> clock when it is turned off for a while.  Is there anything that can or
>> should be done to fix this?
> 
> That need to be qualified with time to be able to say if it's out of
> spec

Thanks.  How would I check that?  I have ntpd starting with to set the
time immediately at startup.  But without that, I get log entries like
these:

Jan 31 10:15:31 net5501 ntpd[20060]: adjusting local clock by 93.846882s

Am I interpreting that correctly?

Regards,
/Lars

>> I see that there are others with the same problem:
>>
>> http://lists.soekris.com/pipermail/soekris-tech/2010-July/016691.html
>>
>> I guess the batteries are only good for 3 or so years and now it has to
>> be replaced with a new Panasonic ML1220/V1AE [1]  Digikey is recommended
>> there, is there another supplier that is withing the Euro zone?  Also,
>> how likely is it that someone with middling soldering skills can do the
>> replacement?
> 
> The batteries are supposed to be last minimum 10 years, typecial 20
> years. They're rechargeable, but a charge last only 1-2 months.
> 
> But is the RTC still works then the batteri is fine.
> 
> 
> Best Regards,
> 
> 
> Soren Kristensen
> 
> CEO & Chief Engineer
> Soekris Engineering, Inc.

___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


Re: [Soekris] Clock losing time on Net5501

2013-02-05 Thread Soren Kristensen
Hi Lars,

Lars Noodén wrote:
> I have a Net5501 that seems to be losing > 90 seconds off the system
> clock when it is turned off for a while.  Is there anything that can or
> should be done to fix this?

That need to be qualified with time to be able to say if it's out of 
spec

> I see that there are others with the same problem:
>
> http://lists.soekris.com/pipermail/soekris-tech/2010-July/016691.html
>
> I guess the batteries are only good for 3 or so years and now it has to
> be replaced with a new Panasonic ML1220/V1AE [1]  Digikey is recommended
> there, is there another supplier that is withing the Euro zone?  Also,
> how likely is it that someone with middling soldering skills can do the
> replacement?

The batteries are supposed to be last minimum 10 years, typecial 20 
years. They're rechargeable, but a charge last only 1-2 months.

But is the RTC still works then the batteri is fine.


Best Regards,


Soren Kristensen

CEO & Chief Engineer
Soekris Engineering, Inc.
___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech


[Soekris] Clock losing time on Net5501

2013-02-05 Thread Lars Noodén
I have a Net5501 that seems to be losing > 90 seconds off the system
clock when it is turned off for a while.  Is there anything that can or
should be done to fix this?

I see that there are others with the same problem:

http://lists.soekris.com/pipermail/soekris-tech/2010-July/016691.html

I guess the batteries are only good for 3 or so years and now it has to
be replaced with a new Panasonic ML1220/V1AE [1]  Digikey is recommended
there, is there another supplier that is withing the Euro zone?  Also,
how likely is it that someone with middling soldering skills can do the
replacement?

Regards
/Lars

[1] http://wiki.soekris.info/Category:Net5501

___
Soekris-tech mailing list
Soekris-tech@lists.soekris.com
http://lists.soekris.com/mailman/listinfo/soekris-tech