path: root/libglusterfs/src/timespec.c
Commit message (Collapse)AuthorAgeFilesLines
* build: MacOSX Porting fixesHarshavardhana2014-04-241-22/+19
| | | | | | | | | | | | | | | | | | | | | Working functionality on MacOSX - GlusterD (management daemon) - GlusterCLI (management cli) - GlusterFS FUSE (using OSXFUSE) - GlusterNFS (without NLM - issues with rpc.statd) Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac BUG: 1089172 Signed-off-by: Harshavardhana <> Signed-off-by: Dennis Schafroth <> Tested-by: Harshavardhana <> Tested-by: Dennis Schafroth <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Anand Avati <>
* libglusterfs: fix bug in timespec adjustmentRavishankar N2013-11-101-4/+4
| | | | | | | | | | | | | The argument to the timespec_adjust_delta() function introudced in commit 6836118b21 needs to be passed by reference rather than by value for the function to do it's job. BUG: 1028663 Change-Id: I62a3636906e67ed35b7786e9553f6819b48f3626 Signed-off-by: Ravishankar N <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Anand Avati <>
* libglusterfs: Add monotonic clocking counter for timer threadHarshavardhana2013-10-151-0/+68
gettimeofday() returns the current wall clock time and timezone. Using these functions in order to measure the passage of time (how long an operation took) therefore seems like a no-brainer. This time suffer's from some limitations: a. They have a low resolution: “High-performance” timing by definition, requires clock resolutions into the microseconds or better. b. They can jump forwards and backwards in time: Computer clocks all tick at slightly different rates, which causes the time to drift. Most systems have NTP enabled which periodically adjusts the system clock to keep them in sync with “actual” time. The adjustment can cause the clock to suddenly jump forward (artificially inflating your timing numbers) or jump backwards (causing your timing calculations to go negative or hugely positive). In such cases timer thread could go into an infinite loop. From 'man gettimeofday': ---------- .. .. The time returned by gettimeofday() is affected by discontinuous jumps in the system time (e.g., if the system administrator manually changes the system time). If you need a monotonically increasing clock, see clock_gettime(2). .. .. ---------- Rationale: For calculating interval timing for Timer thread, all that’s needed should be clock as a simple counter that increments at a stable rate. This is necessary to avoid the jumps which are caused by using "wall time", this counter must be monotonic that can never “tick” backwards, ever. Change-Id: I701d31e71a85a73d21a6c5cd15583e7a5a645eeb BUG: 1017993 Signed-off-by: Harshavardhana <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Anand Avati <>