diff options
author | Teddy Wing | 2018-11-04 15:16:28 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-04 15:16:28 +0100 |
commit | 51509e3b212d6aeae8c946beb454e0ed74e048c7 (patch) | |
tree | e2c4398c24fd6615b70c35bc03efcdc74acfd5fd /lib | |
parent | 2a87aeaefda87c34ff0d240e5e03ce398dd21a02 (diff) | |
download | DomeKey-51509e3b212d6aeae8c946beb454e0ed74e048c7.tar.bz2 |
Add `teprintf()` function
A new function to print to stderr prefixed with a timestamp. The idea is
to make the printed line's format match the Rust logger's.
The Rust logger prints timestamps like this:
2018-11-04T03:16:31.938+01:00
`teprintf` does:
2018-11-04T15:02:21+0100
Unfortunately, I wasn't able to reproduce it exactly. It's missing the
milliseconds because I didn't want to deal with using `gettimeofday`,
and the time zone format isn't right because I didn't know how to format
it easily with a colon.
Resources:
Getting the time in C:
https://stackoverflow.com/questions/9596945/how-to-get-appropriate-timestamp-in-c-for-logs#9596994
Variadic functions in C:
https://stackoverflow.com/questions/205529/passing-variable-number-of-arguments-around
Getting milliseconds in C:
https://stackoverflow.com/questions/10192903/time-in-milliseconds#10192994
https://stackoverflow.com/questions/3673226/how-to-print-time-in-format-2009-08-10-181754-811
https://stackoverflow.com/questions/361363/how-to-measure-time-in-milliseconds-using-ansi-c
Concatenating strings in C:
https://stackoverflow.com/questions/308695/how-do-i-concatenate-const-literal-strings-in-c#308712
https://stackoverflow.com/questions/8465006/how-do-i-concatenate-two-strings-in-c
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions