Fixposition SDK 0.0.0-heads/main-0-g5c7edb5
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
Time conversion tool

Overview

Tool to convert time. This demonstrates the use of the Time utilities

See Fixposition SDK: Build and installation on how to build and run the apps, or Fixposition SDK: Running pre-built apps on how to run the apps.

Command line help

timeconv (release, 0.0.0-heads/main-0-g5c7edb5)
Copyright (c) Fixposition AG (www.fixposition.com) and contributors
License: see the LICENSE files included in the source distribution
This tool can convert time between different time systems.
Usage:
timeconv [flags] [<input>]
Where:
-h -- Print program help screen, and exit
-V -- Print program, version and license information, and exit
-v / -q -- Increase / decrease logging verbosity, multiple flags accumulate
-i -- Ignore errors in input (only from stdin, not for input on command line)
-p <n> -- Precision (number of fractional digits) for float outputs (default: 3)
A single <input> is either provided on the command line or on stdin, one <input> per line.
The program converts the input to the desired output. One <input> has the following format:
<out> <in> <fields...>
The <out> and <in> are the output resp. the input format. Depending on the input format a
a different number of <fields> must be provided. The <input> is then converted to a output
line with <in> and <out> reversed and the <fields> replaced with the corresponding output
format fields. The supported formats are (<...> are the required fields):
11 current system time from CLOCK_REALTIME (input only)
12 current system time from CLOCK_TAI (input only)
21 integer <seconds> and <nanoseconds> (atomic)
22 integer <nanoseconds> (atomic)
23 float <seconds> (atomic)
24 integer (truncated) <seconds> (atomic)
31 float <seconds> (POSIX)
32 integer (truncated) <seconds> (POSIX)
33 integer <seconds> and <nanoseconds> (POSIX)
34 float <seconds> (TAI)
35 integer (truncated) <seconds> (TAI)
41 GPS integer <week> and float <tow>
42 Galileo integer <week> and float <tow>
43 BeiDou integer <week> and float <tow>
44 GLONASS integer <N4>, integer <Nt> and float <TOD>
51 integer <year>, <month>, <day>, <hour>, <minute> and float <second> (UTC)
52 float <day_of_year> (output only)
0 Ignore, don't generate output
The 'atomic' time is seconds since 1970-01-01 00:00:00 UTC, including leapseconds. POSIX is
seconds since the same epoch, but not including leap seconds, i.e. with ambiguities at/during
leapseconds events. Note that 'strict' POSIX rules are used, which may not be consistent with
a Linux system's CLOCK_REALTIME. TAI is like 'atomic' but with an offset of 10 (leapsconds).
Input format 12 may not work correctly if the system isn't configured for leapseconds.
Conversion involving floats may be subject to loss in precision.
See also the documentation in time.hpp.
Examples:
Get current system time as GPS week number and time of week:
timeconv 41 11
echo 41 11 | timeconv
Convert GPS time to BeiDou time:
timeconv 43 41 2341 100000
Get current time in UTC, GPS, Galileo, BeiDou and GLONASS time:
echo -e "51 11\n41 11\n42 11\n 43 11\n 44 11" | timeconv -p 0