Hi Venkat, Thanks for ur response for getting time and date, but yaar, the linux functions gettimeofday() and localtime() are not running in init_module(). These functions can be used in main() function only, but i want a function which can be used in init_module also. Can u please write me a chunk of code in init_module(), which i could run directly. Also, the function gethrtime() returns value in hrtime_t variable, which a typedef of 64-bit signed integer. Do u know any format specifier in RTLinux which can print 64-bit integer value. actually it is only supporting "%d", which is printing a 4-byte value only.
I am facing a lot of problem yaar. Please write me according to ur convinience. Regards, Narendra Kumar Upadhyay TATA Consultancy Services - GG2 Ph. : 91- 0124- 6439120, 6439121 Ext. : 122, 213 ----- Original Message ----- From: "A V" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, April 13, 2002 12:39 PM Subject: Re: [rtl] Current time and date in RTLinux > > 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/ > -- [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/