summaryrefslogtreecommitdiff
path: root/src/test/test-time.c
AgeCommit message (Collapse)Author
2015-11-16tree-wide: sort includesThomas Hindoe Paaboel Andersen
Sort the includes accoding to the new coding style.
2015-11-10time-util: add parse_time(), which is like parse_sec() but allows ↵Lennart Poettering
specification of default time unit if none is specified This is useful if we want to parse RLIMIT_RTTIME values where the common UNIX syntax is without any units but refers to a non-second unit (µs in this case), but where we want to allow specification of units.
2015-02-24test-time: test "infinity" parsing in nanosecondsDaniel Mack
2014-09-29Do not format USEC_INFINITY as NULLZbigniew Jędrzejewski-Szmek
systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This does not look right. Since USEC_INFINITY is one of the valid values, format_timespan() could return NULL, and we should wrap every use of it in strna() or similar. But most callers didn't do that, and it seems more robust to return a string ("infinity") that makes sense most of the time, even if in some places the result will not be grammatically correct.
2014-08-18tests: add tests for time-util.cRonny Chevalier
add tests for: - timezone_is_valid - get_timezones
2014-05-15Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek
No functional change expected :)
2013-04-04util: make time formatting a bit smarterLennart Poettering
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h 55.050003s". Also, while outputting the accuracy is configurable. Basically we now try use "dot notation" for all time values > 1min. For >= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and finally 'us'. This should give reasonably values in most cases.
2013-04-03time: add suppot for fractional time specificationsLennart Poettering
We can now parse "0.5s" as the same as "500ms". In fact, we can parse "3.45years" correctly, too, and any other unit and fraction length.