mirror of
https://github.com/systemd/systemd
synced 2024-10-15 12:34:37 +00:00
timer: consider (usec_t) -1 an invalid timestamp
This commit is contained in:
parent
1fcf71f562
commit
966204e010
2
TODO
2
TODO
|
@ -43,6 +43,8 @@ CGroup Rework Completion:
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
* be more careful what we export on the bus as (usec_t) 0 and (usec_t) -1
|
||||||
|
|
||||||
* check :no-sender logic after PID 1 conversion
|
* check :no-sender logic after PID 1 conversion
|
||||||
|
|
||||||
* increase journal files by a few MB each time, instead of piecemeal
|
* increase journal files by a few MB each time, instead of piecemeal
|
||||||
|
|
|
@ -158,7 +158,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
|
||||||
assert(buf);
|
assert(buf);
|
||||||
assert(l > 0);
|
assert(l > 0);
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0 || t == (usec_t) -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sec = (time_t) (t / USEC_PER_SEC);
|
sec = (time_t) (t / USEC_PER_SEC);
|
||||||
|
@ -176,7 +176,7 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) {
|
||||||
assert(buf);
|
assert(buf);
|
||||||
assert(l > 0);
|
assert(l > 0);
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0 || t == (usec_t) -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sec = (time_t) (t / USEC_PER_SEC);
|
sec = (time_t) (t / USEC_PER_SEC);
|
||||||
|
|
|
@ -64,7 +64,10 @@ dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
|
||||||
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
|
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
|
||||||
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
|
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
|
||||||
|
|
||||||
#define dual_timestamp_is_set(ts) ((ts)->realtime > 0)
|
static inline bool dual_timestamp_is_set(dual_timestamp *ts) {
|
||||||
|
return ((ts->realtime > 0 && ts->realtime != (usec_t) -1) ||
|
||||||
|
(ts->monotonic > 0 && ts->monotonic != (usec_t) -1));
|
||||||
|
}
|
||||||
|
|
||||||
usec_t timespec_load(const struct timespec *ts) _pure_;
|
usec_t timespec_load(const struct timespec *ts) _pure_;
|
||||||
struct timespec *timespec_store(struct timespec *ts, usec_t u);
|
struct timespec *timespec_store(struct timespec *ts, usec_t u);
|
||||||
|
|
Loading…
Reference in a new issue