settimeofday() & reboot or power cycle

Net Llama! netllama
Wed Jan 17 13:40:32 PST 2007


On Wed, 17 Jan 2007, Susan Macchia wrote:
> Hi List,
>
>
>
> I have a conundrum I am trying to figure out.  I have a Mandriva 2006 
> system.  The kernel is 2.6.12-12mdksmp.
>
> I have a process that runs (as root) that calls settimeofday().
> The time is changed and reflected in the UI.  The problem is this:
>
>
>
> When the system is shutdown and restared cleanly the change in time/date 
> sticks.  If instead the power cycle button is pressed (causing an 
> "unclean" shutdown), the time/date DOESN'T stick (and this is the bug). 
> I tried waiting for 1/2-1 hour, executing the sync command and the time 
> still doesn't stick.
>
> I also tested this out with the "date" command (independent of my 
> application) and saw the same phenomenon.
>
> Does anyone know if there is a known bug in the kernel?  Does anyone 
> know if there is a patch or work-around?  Iv'e scoured the kernel.org 
> archives and googled, but haven' found much.

This sounds like expected behavior to me.  Most recent Linux distros 
perform a "/sbin/hwclock --systohc" on shutdown.  If you're hitting the 
power button, that command is not running.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman                        netllama at linux-sxs.org
LlamaLand				http://netllama.linux-sxs.org



More information about the Linux-users mailing list