[omniORB] changing system clock

Geoffrey Hanson hanson at fabric7.com
Fri May 19 09:41:20 BST 2006


> -----Original Message-----
> From: Duncan Grisby [mailto:duncan at grisby.org]
> Sent: Friday, May 19, 2006 4:16 AM
> To: Geoffrey Hanson
> Cc: omniorb-list at omniorb-support.com
> Subject: Re: [omniORB] changing system clock 
> 
> 
> On Thursday 18 May, "Geoffrey Hanson" wrote:
> 
> > Another way to solve this is to, instead of having get_time() return
> > the wall clock, you can have it return the time since the system
> > booted. POSIX has some routines to do this. I'm not sure about
> > non-POSIX systems. This makes you immune from system clock changes.
> 
> What system call does that?
> 
There is a library call clock() that returns the number of clock
ticks, but I haven't found that to work on Linux.

There is also a system call times(). Parameters passed in retrieve
other information, but the call itself returns clock ticks.

The sysconf() library call can then be used to give you the
number of clock ticks per second. With this information, you can
calculate the time since boot up.

I've attached a patch of the change I've been using that illustrates
this. This patch is off of 4.01. I put in Linux ifdef's because
I haven't tested it on any other platform.

> > The only cases where using this method would be invalid 
> would be where
> > you actually need the wall clock time. For example, if 
> you're printing
> > out a log with the time. However, all callers of get_time() that I
> > could see were simply using the time for timing purposes.
> 
> omniORB 4.1 has an option to include the time in its logging, so that
> requires the real time.
> 
Does it use get_time() to retrieve the time when logging?

> When you specify a timeout for a call, you can specify an absolute
> deadline, which also requires the real time.
> 
> Cheers,
> 
> Duncan.
> 
> -- 
>  -- Duncan Grisby         --
>   -- duncan at grisby.org     --
>    -- http://www.grisby.org --
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: posix.cc.patch
Type: application/octet-stream
Size: 1422 bytes
Desc: posix.cc.patch
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20060519/2c99cb27/posix.cc.obj


More information about the omniORB-list mailing list