Skip to content

Commit b64f2f2

Browse files
committed
BUGFIX: Adjust the README to reflect the new functionality
1 parent 1e2902b commit b64f2f2

2 files changed

Lines changed: 35 additions & 7 deletions

File tree

README.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,48 @@ pipx install git+https://codeberg.org/DFIR/time-tools.git
1515

1616
## usage:
1717

18-
### ts_to_isoutc:
18+
### ts_to_iso_utc:
1919

20-
This is a real simple tool that accepts one single timestamp and writes the
21-
converted output to `stdout`. As such, it is intended to be used within a
20+
```commandline
21+
usage: ts_to_iso_utc [-h] [-z] [--version] {convert,subts,subsecs,addsecs} ...
22+
```
23+
24+
This is a tool for timestamp conversion and subtraction, as well as delta
25+
subtraction and addition from and to timestamps.
26+
27+
Output is written to `stdout`. As such, it is intended to be used within a
2228
piped chain of commands or within scripted loops.
2329

24-
#### example:
30+
#### examples:
2531

26-
Timestamp values as input below will yield these results:
32+
##### timestamp conversion:
33+
34+
Timestamp values as input below will yield these results after conversion (command: `convert`).
2735

2836
| original timestamp | converted timestamp (ISO-8601 UTC) | notes |
2937
|-------------------------------------|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
3038
| `2021-11-01T13:26:06+01:00` | `2021-11-01T12:26:06+00:00` | |
31-
| `"Nov 26 09:12:30"` | `2025-11-26T08:12:30+00:00` | Assumes timestamp TZ == system TZ |
39+
| `"2025 Nov 26 09:12:30"` | `2025-11-26T08:12:30+00:00` | Assumes timestamp TZ == system TZ |
3240
| `"2021-11-18 09:20:37"` | `2021-11-18T08:20:37+00:00` | Assumes timestamp TZ == system TZ |
3341
| `"Fri 26 Nov 2021 04:58:00 AM CST"` | `2021-11-26T10:58:00+00:00` | This is NOT the Chinese Standard Time! If you would like Asia/Taipei time, you would need to use `CSTTW` as TZ as defined in `time_tools/common/tzmapping.py`. |
3442
| `"Fri May 2 15:06:24 CEST 2025"` | `2025-05-02T13:06:24+00:00` | Input was taken from `LANG=en_US date`. Parsing will fail if input is not in en_US format. |
43+
44+
##### subtracting timestamps from each other:
45+
46+
This use case will allow you to calculate the delta in seconds for two given
47+
timestamps, for example to calculate the offset between two timelines from
48+
different artifacts.
49+
50+
| younger timestamp | older timestamp | command | delta [s] |
51+
|-------------------------------------|-----------------------------|---------|----------------|
52+
| "Fri 26 Nov 2021 04:58:00 AM CST" | `"2025 Jun 26 09:12:30 CEST"` | `subts` | `112997670.0` |
53+
54+
##### subtracting or adding a delta from or to a timestamp:
55+
56+
Time correction on artifacts requires a known offset to be added or subtracted
57+
to or from a timeline in order to be correlated to the master timeline.
58+
59+
| original timestamp | offset [s] | command | corrected timestamp (ISO-8601 UTC) |
60+
|-------------------------------------|------------|-----------|------------------------------------|
61+
| `"2025 Jun 26 09:12:30 CEST"` | `43674` | `subsecs` | `2025-06-25T19:04:36+00:00` |
62+
| `"Fri 26 Nov 2021 04:58:00 AM CST"` | `86400` | `addsecs` | `2021-11-27T10:58:00+00:00` |

src/time_tools/ts_to_iso_utc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def parse_args() -> argparse.Namespace:
3939
global progname
4040
global progver
4141
epilog = "Examples: " + my_progname + " 2021-11-01T13:26:06+01:00 --> 2021-11-01T12:26:06Z\n" + \
42-
" " + my_progname + " \"Nov 26 09:12:30\" --> 2021-11-26T09:12:30Z (assumes timestamp TZ is system TZ)\n" + \
42+
" " + my_progname + " \"2025 Nov 26 09:12:30\" --> 2021-11-26T09:12:30Z (assumes timestamp TZ is system TZ)\n" + \
4343
" " + my_progname + " \"2021-11-18 09:20:37\" --> 2021-11-18T09:20:37Z (assumes timestamp TZ is system TZ)\n" + \
4444
" " + my_progname + " \"Fri 26 Nov 2021 04:58:00 AM CST\" --> NOT Chinese Standard Time! For Taipei time use CSTTW"
4545
# create the top-level parser

0 commit comments

Comments
 (0)