File: test-datetime-conversion

package info (click to toggle)
time-decode 9.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 568 kB
  • sloc: python: 4,644; sh: 80; makefile: 10
file content (84 lines) | stat: -rwxr-xr-x 2,646 bytes parent folder | download
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
#!/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 53 timestamps:

Active Directory/LDAP:		132763824000000000
Apache Cookie Hex time:		5cc3660547000
Apple Biome 64-bit decimal:	4738766015976964096
Apple Biome hex time:		41c37a95a0000000
BitDate time:			008d597e
Bitwise Decimal time:		2119798016
DHCP6 DUID time:		0001000128d7b040000000000000
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
Julian Date decimal value:	2459475.3333333335
Julian Date hex value:		258753c6aea157
KSUID Decimal:			231908800
LEB128 Hex time:		80cce0aabf2f
Mac OS/HFS+ Decimal Time:	3714753600
Mastodon time:			106948775116800000
Microsoft 128-bit SYSTEMTIME:	e5070900050011001400000000000000
Microsoft FILETIME time:	988ae000:01d7abfe
Microsoft Hotmail time:		feabd701:00e08a98
Microsoft .NET DateTime:	637675056000000000
Motorola time:			330911140000
Mozilla PRTime:			1631908800000000
MS-DOS 32-bit Hex Value:	00a03153
MS Excel 1904 Date:		42994.833333333336
Nokia S40 time:			07e50911140000
Nokia S40 time LE:		e5070911140000
Nokia time:			caca7dbf
Nokia time LE:			bf7dcaca
NSDate - Binary Plist / Cocoa:	653601600
NSDate - iOS 11+:		653601600000000000
NSDate - Mac Absolute time:	653601600.000000
OLE Automation Date:		44456.833333333336
S32 Encoded (Bluesky) time:	3jjupkdk2
Semi-Octet decimal value:	129071020000
Symantec AV time:		330811140000
Unix Hex 32-bit BE:		6144f3c0
Unix Hex 32-bit LE:		c0f34461
Unix Seconds:			1631908800
Unix Milliseconds:		1631908800000
Unix Milliseconds hex:		017bf5582600
VMSD time:			379958,1616146432
Windows 64-bit Hex BE:		01d7abfe988ae000
Windows 64-bit Hex LE:		00e08a98feabd701
Windows Cookie Date:		2559238144,30911486
Windows OLE 64-bit double BE:	40e5b51aaaaaaaab
Windows OLE 64-bit double LE:	abaaaaaa1ab5e540

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
echo "${EXPECTED}" |
    while read line
    do
	echo "${ACTUAL}" | grep -q "${line}"
    done

exit 0