one trickey way is 

U get date and time in init_module where u can access
linux system calls. and record time(nenoseconds) with
gethrtime() also there. 
Then whereever u want date and time again read time
with gethrtime and calculate elapsed time from ur
program startup. Then convert these nanooseconds to
seconds and add it to time. The pseudo code look like
this. I hope it will work.


hrtime_t start_time;

ur_real_time_thread()
{
   hrtime_t current_time;
   hrimte_t elapsed_time;
   current_time = gethrtime();
   elapsed_time = current_time-start_time;
   convert elapsed time to seconds
   add these seconds to ur actual date and time
recorded in init_module.
}

init_module()
{
      get date and time with linux syscalls;
      start_time = gethrtime();
}

--- Norm Dresner <[EMAIL PROTECTED]> wrote:
> Have you tried
>     do_gettimeofday()
> 
>             Norm
>   ----- Original Message ----- 
>   From: Narendra Kumar Upadhyay 
>   To: [EMAIL PROTECTED] 
>   Cc: [EMAIL PROTECTED] 
>   Sent: Friday, April 12, 2002 8:07 AM
>   Subject: [rtl] Current time and date in RTLinux
> 
> 
>   Hi,
>     Is there any method to calculate the current
> time(in hours, minutes and seconds) and date in the
> kernel module of RTLinux.  Actually gettimeofday()
> and localtime() functions are giving correct time
> but we can execute these functions in linux only. I
> want to get time and date during execution of the
> real-time thread. gethrtime( ) function gives time
> from system bootup, which can not solve my purpose.
>    
>       Any idea to get the current time and date in 
> kernel module??? 
>    
>    
>   Regards,
>   Narendra Kumar Upadhyay
> 
>   Ph. : 91- 0124- 6439120, 6439121
>   Ext. : 122, 213
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to