Printout the current timestamp in VxWorks - VxWorks

This is a discussion on Printout the current timestamp in VxWorks - VxWorks ; Is there any VxWorks function to printout the current timestamp on the console or to a file ?...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Printout the current timestamp in VxWorks

  1. Printout the current timestamp in VxWorks

    Is there any VxWorks function to printout the current timestamp on the
    console or to a file ?


  2. Re: Printout the current timestamp in VxWorks

    Look in the ansiTime library, use time() to get the system time in
    seconds (i.e. calendar time), then use ctime() to get the time into a
    string. The difficult part is usualy setting the board time. On all the
    PPC boards i've used, the time always starts at Zero, (00:00 January
    1st, 1990) each time the board is booted. Look into building sntp into
    the kernel to get time from ntp server if you can.


  3. Re: Printout the current timestamp in VxWorks

    Why 00:00? You don't got the RTC(Real Time Clock) or some hw like that
    in your target board?


  4. Re: Printout the current timestamp in VxWorks



    jeanwelly wrote:

    > Why 00:00? You don't got the RTC(Real Time Clock) or some hw like that
    > in your target board?


    is there some way of hooking the RTC into the time() function? I haven't
    been able to find anything like that in the BSP. We ended up writing our
    own time functions...

    David


  5. Re: Printout the current timestamp in VxWorks

    David Lindauer wrote:

    >is there some way of hooking the RTC into the time() function? I haven't
    >been able to find anything like that in the BSP. We ended up writing our
    >own time functions...


    You need to add the ability to read (and probably write) your hardware RTC.
    Then you build a tm structure using data you read from the RTC and call
    mktime() which returns time_t number of seconds since the epoch. You then
    use this value to build a timespec structure and call closk_settime() to
    set the VxWorks clock.

    You may choose to write your RTC access as a driver or a set of library
    functions and you the rest in the BSP's sysHwInit() or related functions,
    in usrAppInit(), or even early in your application, all as you see fit.

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at comcast dot net | - The Who, Bargain

  6. Re: Printout the current timestamp in VxWorks


    David Lindauer wrote:
    > jeanwelly wrote:
    >
    > > Why 00:00? You don't got the RTC(Real Time Clock) or some hw like that
    > > in your target board?

    >
    > is there some way of hooking the RTC into the time() function? I haven't
    > been able to find anything like that in the BSP. We ended up writing our
    > own time functions...
    >
    > David


    David,

    I'm using a Motorola mvme-5107 and the BSP documents suggest that the
    RTC can be accessed via registers in the HAWK ASIC. We weren't able to
    access these registers, it was likely a mapping problem. We didn't
    pursue it further because we had an easy work around.

    Have you had any success getting at the RTC in your hardware?

    Doug


  7. Re: Printout the current timestamp in VxWorks


    David Lindauer wrote:
    > jeanwelly wrote:
    >
    > > Why 00:00? You don't got the RTC(Real Time Clock) or some hw like that
    > > in your target board?

    >
    > is there some way of hooking the RTC into the time() function? I haven't
    > been able to find anything like that in the BSP. We ended up writing our
    > own time functions...
    >
    > David


    David,

    I'm using a Motorola mvme-5107 and the BSP documents suggest that the
    RTC can be accessed via registers in the HAWK ASIC. We weren't able to
    access these registers, it was likely a mapping problem. We didn't
    pursue it further because we had an easy work around.

    Have you had any success getting at the RTC in your hardware?

    Doug


+ Reply to Thread