All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Abhijit Majumdar <abhijit.majumdar@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Question about getting system time
Date: Fri, 14 May 2010 07:44:25 +0200	[thread overview]
Message-ID: <4BECE339.3060902@domain.hid> (raw)
In-Reply-To: <2319761F7FA0D1479BA77EC2E0A8E7BCE3D6E7@domain.hid>

Abhijit Majumdar wrote:
> Hi folks
> 
>  
> 
> I am facing a strange problem in getting system time.
> 
>  
> 
> My requirement:
> 
>  
> 
>  In a hard real time task I need to get the current system time and
> store it in a structure. Later at some point of time a java application
> a windows system is supposed to convert it into user-readable date-time
> format. I am using rt_timer_tsc2ns(rt_timer_read()) to get the current
> time. 

You should be using rt_timer_ticks2ns(rt_timer_read()), rt_timer_tsc2ns
should be used with rt_timer_tsc().


> 
>  
> 
> Problem: 
> 
>  
> 
> However the java application prints a date in 1980 (I converted nanosec
> to millisec before using java API). I kind of expected rt_timer_tsc2ns
> to return nanoseconds from 1st Jan 1970 because it is common for
> programming tools and languages, although I must admit that I did not
> see that in the xenomai API documentation.
> 
>  
> 
> Am I doing something wrong? Should I have to compile the kernel with
> some specific parameter?

The problem you may have is that Xenomai clock is synchronized with
Linux clock when Xenomai starts, and it may happen at a time when Linux
clock is not yet set to the current time. If that is the case, you
should set xenomai's time during the boot process after Linux' time has
been set. Currently, the only service to do this is clock_settime,
implemented by the posix skin.

-- 
					    Gilles.


  reply	other threads:[~2010-05-14  5:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 22:14 [Xenomai-help] Question about getting system time Abhijit Majumdar
2010-05-14  5:44 ` Gilles Chanteperdrix [this message]
2010-05-14 10:34 ` Andreas Glatz
2010-05-14 10:42   ` Gilles Chanteperdrix
2010-05-17 16:27     ` Steve Deiters
2010-05-17 16:52       ` Jan Kiszka
2010-05-17 17:05         ` Steve Deiters
2010-05-17 17:13           ` Jan Kiszka
2010-05-17 18:02             ` Josh Karch
2010-05-17 18:23               ` Jan Kiszka
2010-05-17 18:51               ` Thomas Lockhart
2010-05-17 22:48             ` Steve Deiters
2010-05-17 23:50               ` Gilles Chanteperdrix
2010-05-17 23:53               ` Gilles Chanteperdrix
2010-05-18  0:23                 ` Steve Deiters
2010-05-18  7:04                   ` Jan Kiszka
2010-05-18  7:59                     ` Gilles Chanteperdrix
2010-05-18  8:38           ` Wolfgang Mauerer
2010-05-18 10:11             ` Gilles Chanteperdrix
2010-05-18 12:11               ` Wolfgang Mauerer
2010-05-18 12:41                 ` Gilles Chanteperdrix
2010-05-18 14:58                   ` [Xenomai-core] " Wolfgang Mauerer
2010-05-18 15:07                     ` Gilles Chanteperdrix
2010-05-18 18:41                     ` Gilles Chanteperdrix
2010-05-18 20:23                       ` Wolfgang Mauerer
2010-05-18 21:19                         ` Gilles Chanteperdrix
2010-05-18 22:09                           ` Jan Kiszka
2010-05-18 22:24                             ` Gilles Chanteperdrix
2010-05-18 23:02                               ` Jan Kiszka
2010-05-19  5:49                                 ` Gilles Chanteperdrix
2010-05-19  7:11                                   ` Jan Kiszka
2010-05-21  8:55                                     ` Gilles Chanteperdrix
2010-05-27 15:35                                       ` Wolfgang Mauerer
2010-05-19 19:16                                   ` Daniele Nicolodi
2010-05-19 20:55                                     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BECE339.3060902@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=abhijit.majumdar@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.