File: test-unix-ts

package info (click to toggle)
time-decode 10.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,416 kB
  • sloc: python: 5,217; sh: 108; makefile: 10
file content (27 lines) | stat: -rwxr-xr-x 568 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
#!/bin/sh

# Stops the execution if a command has an error 
set -e

# Defines expected results
EXPECTED=$(cat <<'EOF'
Unix Seconds: 2021-09-19 07:24:36.000000 UTC
Unix Milliseconds: 2021-09-19 07:24:59.334000 UTC
EOF
)

# Run time-decode to decode unix epoch in secs
SECONDS_OUTPUT=$(time-decode --unixsec 1632036276)

# Run time-decode to decode unix epoch in milliseconds
MILLISECONDS_OUTPUT=$(time-decode --unixmilli 1632036299334)

# Combine the outputs
ACTUAL="${SECONDS_OUTPUT}
${MILLISECONDS_OUTPUT}"

if [ "$ACTUAL" = "$EXPECTED" ]; then
    exit 0
fi

exit 1