Questions tagged [gettimeofday]

The function gettimeofday() can get the time as well as a timezone.

Read more in the Linux Reference.

100 questions
0
votes
0 answers

Return value does not match the actual returned value

I have a function that returns the current gettimeofday value as a double. The problem is the value being returned I see inside the function is not the same as the value that gets assigned outside the function. Here is a gdb snippet - (gdb) n 3391 …
punekr12
  • 653
  • 2
  • 7
  • 14
0
votes
1 answer

Timeval struct usage

I needed to calculate the time it takes to run a certain function and ran into the following code,record & output the execution time of a piece of code in nanoseconds And also is there any difference between struct timeval timer_spent & timeval…
Siva
  • 141
  • 1
  • 2
  • 12
0
votes
2 answers

Some help using structures, references, and gettimeofday function

I was hoping some of you code geniuses might help a coding impaired individual like myself. I have to create this program that puts a timestamp on another program I previously created. Right now Im in the process of trying to obtain time using the…
PresidentRFresh
  • 93
  • 1
  • 2
  • 10
0
votes
2 answers

gettimeofday crashes MPI?

I have an mpi program whose run time I'm trying to measure. So I add in a 2 calls to gettimeofday, and that's where everything stops working. For some reason, it only crashes if I have the 2nd call to gettimeofday in there. Here's the message I…
NickLokarno
  • 300
  • 6
  • 20
0
votes
1 answer

Evaluating Random Number Generator as per Knuth [2, 41-79]

I have created a random number generator using gettimeofday() function, in C. Now,I need to evaluate this using statistical or empirical methods developed by Knuth. I searched exhaustively for the same, but could not find a workable solution. Or I…
Krishna
  • 425
  • 3
  • 6
  • 14
0
votes
1 answer

How does weekly reminders work?

Is there an algorithm for weekly reminders ? For example, I set a reminder for Thursday & I check the "weekly" option. The Reminder is supposed to alert every Thursday then,but how is this done? I thought about an idea, but I guess it's very…
Sana Joseph
  • 1,948
  • 7
  • 37
  • 58
0
votes
4 answers

Python clock function on FreeBSD

While testing Pythons time.clock() function on FreeBSD I've noticed it always returns the same value, around 0.156 The time.time() function works properly but I need a something with a slightly higher resolution. Does anyone the C function it's…
Dan
  • 710
  • 5
  • 15
0
votes
2 answers

gettimeofday/settimeofday for Making a Function Appear to Take No Time

I've got an auxiliary function that does some operations that are pretty costly. I'm trying to profile the main section of the algorithm, but this auxiliary function gets called a lot within. Consequently, the measured time takes into account the…
geometrian
  • 14,775
  • 10
  • 56
  • 132
-1
votes
1 answer

how to get datetime from gettimeofday in C?

how to get datetime from gettimeofday in C? I need convert tv.tv_sec to Hour:Minute:Second xx without functions such as localtime and strftime ..., just get it by computing. for instance tv.tv_sec/60)%60 will be minute #include #include…
Colin
  • 75
  • 1
  • 2
  • 9
-2
votes
1 answer

cudaEvent and gettimeofday report drastically different time

I'm trying to time a loop by using either gettimeofday or cudaEventRecord. However, they report very different results. Here's the pseudo code: // get time here (start) while (..) { . .. } // get time here (stop) // calculate…
user3813674
  • 2,553
  • 2
  • 15
  • 26
1 2 3 4 5 6
7