Re: C functions to set the linux hardware clock

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 03/30/04


Date: Tue, 30 Mar 2004 09:27:43 -0500

In article <cdad3f1f.0403300430.6127782b@posting.google.com>,
 fr.lair@laposte.net (flair) wrote:
> I am programming a software in C language, for Linux. This software
> (running in super-user mode) will have to set the hardware clock.
> Which C functions can I use to adjust the hardware clock?
>
> I have already tried to use the function "settimeofday", but when I
> restart the computer, the time is not saved.

This is an OS-specific thing, so you should probably ask in a Linux
newsgroup.

Or just read the source code of the "date" command and see what it does
when you set the time.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • Re: Time difference between Win98 and Fedora
    ... Since Windows will set the hardware clock to local time, ... > Now that Linux and Windows both expect the hardware clock to represent ... When you next boot into Windows, it will realize that it's the ...
    (Fedora)
  • Re: [SLE] time is running far too fast (2 yrs ahead in 1 week)
    ... It doesn't need to be on the internet, ... If your hardware clock is the one that is bad, ... Then boot up in Linux and make sure that the time zone is set correctly. ...
    (SuSE)
  • Re: [SLE] time is running far too fast (2 yrs ahead in 1 week)
    ... It doesn't need to be on the internet, ... If your hardware clock is the one that is bad, ... Then boot up in Linux and make sure that the time zone is set correctly. ...
    (SuSE)
  • Re: how to change date of system
    ... Linux doesn't do that. ... local time), and I'm sure that's *not* what you mean. ... Linux doesn't mess with the hardware clock at all, ... Windows sets the hardware clock to local ...
    (Debian-User)
  • Re: timezones
    ... Don't use Windows myself, but I seem to recall that this is a classic ... Linux setup suggests and assumes that your hardware ... actually sets your hardware clock this way. ... still assumes it is UTC + 0, and adds another hour for BST, not on the ...
    (Debian-User)