1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00
Commit Graph

34 Commits

Author SHA1 Message Date
Daniel Mack
8e8933ca0f shared/time-util: fix gcc5 warning
CC       src/shared/libsystemd_shared_la-time-util.lo
src/shared/time-util.c: In function 'parse_nsec':
src/shared/time-util.c:789:25: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
                 if (!*s != 0)
                         ^
2015-02-24 13:26:47 +01:00
Lennart Poettering
63c372cb9d util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
2015-02-03 02:05:59 +01:00
Lennart Poettering
bb1fada8cc time: don't do comparison twice 2014-10-24 19:10:09 +02:00
Lennart Poettering
75a5f1d837 time: minor simplification 2014-10-24 19:09:36 +02:00
Lennart Poettering
65de0395ff time: earlier exit from format_timestamp_relative() on special times 2014-10-24 19:08:22 +02:00
Lennart Poettering
e73c78c275 time: also support 'infinity' syntax in parse_nsec()
Let's make parse_usec() and parse_nsec() work similar
2014-10-24 19:07:31 +02:00
Lennart Poettering
5ab99e076c time: functions named "internal" really shouldn't be exported
Also, let's try to make function names descriptive, instead of using
bools for flags.
2014-10-08 22:37:45 +02:00
Jan Synacek
a62e83b48c journalctl: make --utc work everywhere
The --utc option was introduced by commit
9fd290443f.
Howerver, the implementation was incomplete.
2014-10-03 08:38:01 -04:00
Zbigniew Jędrzejewski-Szmek
b1d6dcf5a5 Do not format USEC_INFINITY as NULL
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-09-29 11:09:39 -04:00
Kay Sievers
3a43da2832 time-util: add and use USEC/NSEC_INFINIY 2014-07-29 13:20:20 +02:00
Tom Gundersen
77ff2de999 time-util: add clock_boottime_or_monotonic
CLOCK_BOOTTIME is not supported by timerfd on older kernels, so for the time beeing,
use this helper instead which will fallback to CLOCK_MONOTONIC if CLOCK_BOOTTIME is
not supported.
2014-07-24 19:02:58 +02:00
Lennart Poettering
7568345034 shared: make timezone and locale enumeration and validation generic
This way we can reuse it other code thatn just localectl/localed +
timedatectl/timedated.
2014-07-07 15:25:55 +02:00
Lennart Poettering
609e002e78 time-util: make sure USEC_PER_SEC and friends are actually of type usec_t 2014-05-22 11:44:03 +09:00
Zbigniew Jędrzejewski-Szmek
de0671ee7f Remove unnecessary casts in printfs
No functional change expected :)
2014-05-15 15:29:58 +02:00
Lennart Poettering
5ba6e0949c time: support @ syntax for denoting times since the UNIX epoch 1970-1-1 2014-03-25 04:08:16 +01:00
Zbigniew Jędrzejewski-Szmek
4d89874af6 logging: reduce send timeout to something more sensible
For a user, the timeout of 1 min per message seems equivalent to a hang.
If journald cannot process a message from PID1 for 10 ms then something
is significantly wrong. It's better to lose the message and continue.
2013-12-20 22:47:26 -05:00
Zbigniew Jędrzejewski-Szmek
b5dd814873 Fix a few signed/unsigned format string issues
Since numbers involved are all small, behaviour was correct already.

https://bugzilla.redhat.com/show_bug.cgi?id=1043304
2013-12-15 17:49:28 -05:00
Lennart Poettering
966204e010 timer: consider (usec_t) -1 an invalid timestamp 2013-11-11 15:54:42 +01:00
Lennart Poettering
1fcf71f562 timer: properly format relative timestamps in the future 2013-11-11 15:54:42 +01:00
Kay Sievers
7759ecb21e silent a few more gcc warnings 2013-10-21 18:40:33 +02:00
Lennart Poettering
03cc26dda4 timedated: expose time and NTP sync flag via the bus
This way, timedatectl can be run over the network and determine all
properties correctly from the server rather than the client.
2013-10-17 01:03:39 +02:00
Zbigniew Jędrzejewski-Szmek
f02d836794 logs-show: add short-precise mode with us timestamps
Also, always show us timestamps in verbose mode.

https://bugzilla.redhat.com/show_bug.cgi?id=991678
2013-08-20 21:18:43 -04:00
Lennart Poettering
7c537b2e28 util: tweak format_timespan() a bit
Make sure to always print out at least one valid component instead of
falling back early to 0.
2013-04-04 17:06:00 +02:00
Lennart Poettering
2fa4092c28 util: make time formatting a bit smarter
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-04 02:56:56 +02:00
Lennart Poettering
cb0dac0548 time: add suppot for fractional time specifications
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.
2013-04-03 23:00:08 +02:00
Lennart Poettering
7f602784de util: rename parse_usec() to parse_sec() sinds the default unit is seconds
Internally we store all time values in usec_t, however parse_usec()
actually was used mostly to parse values in seconds (unless explicit
units were specified to define a different unit). Hence, be clear about
this and name the function about what we pass into it, not what we get
out of it.
2013-04-03 20:12:57 +02:00
Zbigniew Jędrzejewski-Szmek
8333c77edf Always use errno > 0 to help gcc
gcc thinks that errno might be negative, and functions could return
something positive on error (-errno). Should not matter in practice,
but makes an -O4 build much quieter.
2013-03-29 10:12:41 -04:00
Lennart Poettering
b719810db4 dbus: properly serialize calendar timer data
As it turns out the bus properties for timer units wre really broken,
so let's clean this up for good and properly add calendar timer
serialization. We really should get that right before finalizing the
bus API documentation in the wiki...
2013-01-10 00:56:32 +01:00
Lennart Poettering
cae0c5e042 core: properly initialize kernel timestamp 2013-01-08 01:27:39 +01:00
Lennart Poettering
92134489ab time-util: teach parse_timestamp to parse weekdays 2012-11-23 22:52:46 +01:00
Lennart Poettering
6a741b4a2b path-util: when parsing a timestamp we don't know the timezone 2012-11-23 22:52:38 +01:00
Lennart Poettering
decad9103e util: teach parse_timestamp() to parse results of format_timestamp_relative() 2012-11-23 22:20:15 +01:00
Lennart Poettering
bbb8486e17 util: rename format_timestamp_pretty() to format_timestamp_relative() because that describes much better what it does 2012-11-23 22:12:59 +01:00
Lennart Poettering
9a98c7a156 util: split off time related calls from util.[ch] into time-util.[ch] 2012-11-23 22:07:24 +01:00