1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#!/bin/sh
# Stops the execution, if an error is encountered
set -e
# Defines expected results and removes blank lines as well as
# whitespace characters
EXPECTED=$(cat <<'EOF' | sed '/^$/d' | sed 's/\s//g'
Converting 2021-09-17 20:00:00.000 to 65 timestamps:
Active Directory/LDAP: 132763824000000000
Apache Cookie Hex time: 5cc3660547000
Apple Biome 64-bit decimal: 4738766015976964096
Apple Biome Hex time: 41c37a95a0000000
Apple NSDate - bplist / Cocoa: 653601600
Apple NSDate - iOS 11+: 653601600000000000
Apple NSDate - Mac Absolute: 653601600.000000
Binary Coded Decimal: 210917200000
BitDate time: 008d597e
Bitwise Decimal time: 2119798016
DHCPv6 DUID time: 0001000128d7b040000000000000
Discord time: 888514648473600000
DVR (WFS / DHFS) File System: 56634000
exFAT time: 5331a000
FAT Date + Time: 315300a0
GMail Boundary time: 00000000000054700005cc366000
GMail Message ID time: 17bf558260000000
Google Chrome: 13276382400000000
Google EI time: wPNEYQ
GPS time: 1315944018
GSM time: 12907102000000
HFS / HFS+ 32-bit Hex BE: dd6aa440
HFS / HFS+ 32-bit Hex LE: 40a46add
HFS+ Decimal Time: 3714753600
JET LogTime: 0000141109790000
Julian Date decimal: 2459475.3333333335
Julian Date hex: 258753c6aea157
KSUID Alpha-numeric: 1yHW4BvYEsqwnxxyTD8WDMbBLpx
KSUID Decimal: 231908800
LEB128 Hex time: 80cce0aabf2f
LinkedIn Activity time: 6844721607478237494
Mastodon time: 106948775116800000
Microsoft .NET DateTime Ticks: 637675056000000000
Microsoft 128-bit SYSTEMTIME: e5070900050011001400000000000000
Microsoft DTTM Date: a7998d00
Microsoft Excel 1904 Date: 42994.833333333336
Microsoft Hotmail time: feabd701:00e08a98
Microsoft MS-DOS 32-bit Hex: 00a03153
Motorola time: 330911140000
Mozilla PRTime: 1631908800000000
Nokia S40 time: 07e50911140000
Nokia S40 time LE: e5070911140000
Nokia time: caca7dbf
Nokia time LE: bf7dcaca
S32 Encoded (Bluesky) time: 3jjupkdk2
Semi-Octet decimal: 129071020000
Sonyflake time: 52d7bbb00000000
Symantec AV time: 330811140000
TikTok time: 7008994926054604800
Twitter time: 1438955917931446272
ULID time: 01FFTNG9G03YS9JTHPZCQPJF66
Unix Hex 32-bit BE: 6144f3c0
Unix Hex 32-bit LE: c0f34461
Unix Milliseconds: 1631908800000
Unix Milliseconds hex: 017bf5582600
Unix Seconds: 1631908800
UUID time: d6cda000-17f1-11ec-b1fd-30d16be2f1fd
VMSD time: 379958,1616146432
Windows Cookie Date: 2559238144,30911486
Windows FILETIME (Low|High): 988ae000:01d7abfe
Windows FILETIME BE: 01d7abfe988ae000
Windows FILETIME LE: 00e08a98feabd701
Windows OLE 64-bit hex BE: 40e5b51aaaaaaaab
Windows OLE 64-bit hex LE: abaaaaaa1ab5e540
Windows OLE Automation Date: 44456.833333333336
EOF
)
# Run time-decode to decode unix epoch in secs and millis, remove
# blank lines and whitespace
ACTUAL="$(time-decode --timestamp '2021-09-17 20:00:00.000' \
| sed '/^$/d' | sed 's/\s//g')"
# Checks, if each expected line exists in the actual results
# This won't fail if additional timestamp formats are added in the
# future
EXPECTED_FIXED=$(echo "$EXPECTED" | grep -v -E 'KSUID|ULID|UUID')
ACTUAL_FIXED=$(echo "$ACTUAL" | grep -v -E 'KSUID|ULID|UUID')
echo "${EXPECTED_FIXED}" |
while read line; do
if ! echo "${ACTUAL_FIXED}" | grep -q "${line}"; then
echo "NOMATCH: ${line}"
exit 1
fi
done
exit 0
|