Compare commits

..

2 Commits
2.1 ... 2.1.1

Author SHA1 Message Date
Miroslav Lichvar
7a7cf6a5ce doc: update NEWS 2015-06-23 16:02:17 +02:00
Miroslav Lichvar
c2f83bd8a4 sys: fix clock stepping by integer number of seconds on Linux
The kernel requires in the ADJ_SETOFFSET | ADJ_NANO mode that the
timex.time.tv_usec value is smaller than 10^9 nanosecond, which wasn't
the case with a negative integer offset (e.g. inserted leap second).
2015-06-23 15:08:42 +02:00
2 changed files with 12 additions and 5 deletions

7
NEWS
View File

@@ -1,3 +1,10 @@
New in version 2.1.1
====================
Bug fixes
---------
* Fix clock stepping by integer number of seconds on Linux
New in version 2.1
==================

View File

@@ -193,12 +193,12 @@ TMX_ApplyStepOffset(double offset)
struct timex txc;
txc.modes = ADJ_SETOFFSET | ADJ_NANO;
if (offset >= 0) {
txc.time.tv_sec = offset;
} else {
txc.time.tv_sec = offset - 1;
}
txc.time.tv_sec = offset;
txc.time.tv_usec = 1.0e9 * (offset - txc.time.tv_sec);
if (txc.time.tv_usec < 0) {
txc.time.tv_sec--;
txc.time.tv_usec += 1000000000;
}
return adjtimex(&txc);
}