aboutsummaryrefslogtreecommitdiff
path: root/lib/datetime.sh
blob: 7f67a49cf7f2ca8381e4b34cfe8a93f171a96fac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh

# date_iso_utc
date_now_iso_utc() {
  TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"
}

posix_time_microseconds() {
  bc -e "($(perl -MTime::HiRes=gettimeofday -MPOSIX=strftime -e '($s,$us) = gettimeofday(); printf "%d.%06d\n", $s, $us') * 1000)" | cut -d '.' -f 1
}