Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Getting "absolute time" in Linux

View parsed - Show only message text

Path: g2news2.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!news3.cnt.ru!mtu.ru!news.comcor-tv.ru!not-for-mail
From: malc <m...@pulsesoft.com>
Newsgroups: comp.os.linux.development.system
Subject: Re: Getting "absolute time" in Linux
Date: Tue, 14 Nov 2006 23:42:09 +0000 (UTC)
Organization: Comcor-TV
Lines: 29
Message-ID: <m2odr9r3wj.fsf@pulsesoft.com>
References: <ejd3ob$5c1$1@newsfeed.pit.comms.marconi.com>
NNTP-Posting-Host: 10.0.66.9
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.comcor-tv.ru 1163547729 88108 10.0.66.9 (14 Nov 2006 23:42:09 GMT)
X-Complaints-To: newsmaster@comcor-tv.ru
NNTP-Posting-Date: Tue, 14 Nov 2006 23:42:09 +0000 (UTC)
X-Bad-Date: Wed, 15 Nov 2006 02:42:52 +0300
User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.12 (Portable Code, linux)
Cancel-Lock: sha1:jISBEbEFvU9CvdpeRPZoz48d1H8=

Boris Benenson <boris.benen...@marconi.com> writes:

> Is there a way in either standard or Real-time Linux to get "absolute
> number of ticks (or seconds) since the Epoc (or some other
> configurable starting point), regardless of the kernel clock resets
> via settimeofday() and the RTC resets via hwclock set and regardless
> of the system reboots?

http://www.opengroup.org/onlinepubs/000095399/functions/clock_gettime.html
CLOCK_MONOTONIC

`man clock_gettime' on this Linux box says:

AVAILABILITY
       On  POSIX  systems on which these functions are available,
       the symbol _POSIX_TIMERS is defined  in  <unistd.h>  to  a
       value greater than 0.  The symbols _POSIX_MONOTONIC_CLOCK,
       _POSIX_CPUTIME,   _POSIX_THREAD_CPUTIME   indicate    that
       CLOCK_MONOTONIC,                 CLOCK_PROCESS_CPUTIME_ID,
       CLOCK_THREAD_CPUTIME_ID   are   available.    (See    also
       sysconf(3).)


Availablility of CLOCK_MONOTONIC is system (and not just libc)
specific (for instance stock Linux 2.4 kernels do not have it,
2.6 do)

--
vale

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google