Skip to content

Commit

Permalink
Avoid overflow errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Savage committed Jan 7, 2013
1 parent 0827a2a commit 9af9bfd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/ruby_prof/rp_measure_process_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ measure_process_time()
#if defined(__linux__)
struct timespec clock;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID , &clock);
return (clock.tv_sec * 1000000000 + clock.tv_nsec) / 1000000000.0;
return clock.tv_sec + (clock.tv_nsec/1000000000.0);
#elif defined(_win32)
FILETIME createTime;
FILETIME exitTime;
Expand Down
2 changes: 1 addition & 1 deletion ext/ruby_prof/rp_measure_wall_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ measure_wall_time()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000000 + tv.tv_usec) / 1000000.0;
return tv.tv_sec + (tv.tv_usec/1000000.0);
}

prof_measurer_t* prof_measurer_wall_time()
Expand Down

0 comments on commit 9af9bfd

Please sign in to comment.