Linux System Calls Question:

Download Job Interview Questions and Answers PDF

How to get microseconds of system time from Redhat Linux 4.0?

Linux System Calls Interview Question
Linux System Calls Interview Question

Answer:

The systemcall "gettimeofday" can be used to get the time in microseconds. The call takes two arguments.
1- struct timeval
2- struct timezone ( for timezone information). you can have second argument null.
timeval structure has two fields:
tv_sec ( represents time in seconds)
tv_usec ( represents time in microseconds )

the code snapshot is :
////
struct timeval t_time;
gettimeofday(&t_time,NULL);

Download Linux System Calls Interview Questions And Answers PDF

Previous QuestionNext Question
What happens when we do insmod & rmmod in Linux Device Drivers?what is mean by raid and what are all raids available even in software and hardware?