Difference between revisions of "Gptime"
Jump to navigation
Jump to search
(Created page with "A useful utility to convert times. echo "1789-07-14 17:30:00.000" | gptime -i "yyyy-MM-dd hh:mm:ss.zzz" -o gps-week Run this command to know the GPS week index for the W...") |
(No difference)
|
Revision as of 14:14, 21 November 2022
A useful utility to convert times.
echo "1789-07-14 17:30:00.000" | gptime -i "yyyy-MM-dd hh:mm:ss.zzz" -o gps-week
Run this command to know the GPS week index for the Storming of the Bastille. GPS weeks are counted positively from 1980-01-06. The accepted date/time formats are listed here for input (option '-i') and output (option '-o'). A documentation of all the numerous options is available by running
gptime -h all
If a file named 'solaire_20221121.dat' contains the following lines:
[...] BEGIN 1669034640 60.1 58.1 45.0 35.8 21.4 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 55 5.5 20.3 0 300 END BEGIN 1669034650 60.1 58.1 45.0 35.8 21.4 20.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 55 5.3 20.3 0 300 END BEGIN 1669034660 60.1 57.7 45.0 35.8 21.4 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 56 5.7 20.3 0 300 END BEGIN 1669034670 60.1 57.7 44.6 35.8 21.8 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 56 5.5 20.3 0 300 END
The second column can be converted from time_t (number of seconds since 1970-01-01 00:00:00) to a human readable time by runnning:
cat solaire_20221121.dat | gptime -i time_t -c 2
which produces:
BEGIN 2022-11-21 12:44:00.000000 60.1 58.1 45.0 35.8 21.4 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 55 5.5 20.3 0 300 END BEGIN 2022-11-21 12:44:10.000000 60.1 58.1 45.0 35.8 21.4 20.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 55 5.3 20.3 0 300 END BEGIN 2022-11-21 12:44:20.000000 60.1 57.7 45.0 35.8 21.4 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 56 5.7 20.3 0 300 END BEGIN 2022-11-21 12:44:30.000000 60.1 57.7 44.6 35.8 21.8 20.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 56 5.5 20.3 0 300 END