LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-28-2006, 02:45 AM   #1
Animalector
LQ Newbie
 
Registered: Jun 2005
Posts: 10

Rep: Reputation: 0
Synchronising system clock to UTC while using a timer


I am using a linux timer:

timer_create(CLOCK_REALTIME,NULL,&AbsTimerId)

and setting up the timer to fire first at the half second of the current second and then every second afterwards:

AbsTimer.it_value.tv_sec = TimeNow.tv_sec;
AbsTimer.it_value.tv_nsec = 500 000 000;
AbsTimer.it_interval.tv_sec = 1;

Now if I choose to update the system clock, using another function to synchronise it to UTC what happens to this current timer, will it next fire at the half second again and then every second after, or will the timer need to be closed, and re-initialised?

Here is what I see happening
timer fires at .5sec, 1.5 sec, 2.5sec, 3.5sec etc...
Function to synchronise comes along at some point before the timer fires ie between .5 and 1.5, and changes the clock to 5.00sec. (for example) Will the timer then fire half a sec later? or a full second later?

Thanks
Andy O
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting system time to UTC triley Linux - General 2 08-25-2009 08:56 PM
clock timer problem Half_Elf Linux - General 2 10-02-2004 06:19 PM
System Clock UTC Whatever.. berkay Linux - Newbie 3 09-24-2004 02:29 AM
synchronising system time with an atom clock qanopus Linux - Software 2 05-13-2003 08:58 AM
my clock is UTC??? mathfeel Linux - General 2 08-16-2002 09:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration