mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
Add DSL functions for integer nanoseconds since the epoch (#1326)
* DSL functions for 64-bit nano-epoch timestamps * strfntime * nsec2gmt; move sec/nsec pairs adjacent to one another * update on-line help * artifacts from `make dev` * unit-test files
This commit is contained in:
parent
4c0731d395
commit
d72ef826fb
112 changed files with 1805 additions and 173 deletions
29
test/input/gmt2nsec
Normal file
29
test/input/gmt2nsec
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
gmt
|
||||
1970-01-01T00:00:00Z
|
||||
1970-01-01T00:00:00.Z
|
||||
1970-01-01T00:00:01Z
|
||||
1970-01-01T00:00:01.0Z
|
||||
1970-01-01T00:00:10Z
|
||||
1970-01-01T00:00:10.00Z
|
||||
1970-01-01T00:01:40Z
|
||||
1970-01-01T00:01:40.1Z
|
||||
1970-01-01T00:16:40Z
|
||||
1970-01-01T00:16:40.12Z
|
||||
1970-01-01T02:46:40Z
|
||||
1970-01-01T02:46:40.123Z
|
||||
1970-01-02T03:46:40Z
|
||||
1970-01-02T03:46:40.1234Z
|
||||
1970-01-12T13:46:40Z
|
||||
1970-01-12T13:46:40.12345Z
|
||||
1970-04-26T17:46:40Z
|
||||
1970-04-26T17:46:40.123456Z
|
||||
1973-03-03T09:46:40Z
|
||||
1973-03-03T09:46:40.1234567Z
|
||||
2001-09-09T01:46:40Z
|
||||
2001-09-09T01:46:40.12345678Z
|
||||
2015-05-19T11:49:40Z
|
||||
2015-05-19T11:49:40.123456789Z
|
||||
2017-07-14T02:40:00Z
|
||||
2017-07-14T02:40:00.999Z
|
||||
2033-05-18T03:33:20Z
|
||||
2033-05-18T03:33:20.999999Z
|
||||
17
test/input/strfntime-tz.mlr
Normal file
17
test/input/strfntime-tz.mlr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
end {
|
||||
|
||||
print "---------------------------------------------------------------- TIMEZONE";
|
||||
print "TZ is", ENV["TZ"];
|
||||
|
||||
print "---------------------------------------------------------------- STRFNTIME";
|
||||
print strfntime(123456, "%Y-%m-%dT%H:%M:%SZ");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%S");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%3S");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%S %z");
|
||||
print strfntime(123456, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime(123456, "%Y-%m-%d %H:%M:%S %z");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime(0, "%Y-%m-%d %H:%M:%S %z");
|
||||
|
||||
}
|
||||
17
test/input/strfntime_local-tz.mlr
Normal file
17
test/input/strfntime_local-tz.mlr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
end {
|
||||
|
||||
print "---------------------------------------------------------------- TIMEZONE";
|
||||
print "TZ is", ENV["TZ"];
|
||||
|
||||
print "---------------------------------------------------------------- STRFNTIME_LOCAL";
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%S");
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%3S");
|
||||
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%S %z");
|
||||
print strfntime_local(123456, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime_local(123456, "%Y-%m-%d %H:%M:%S %z");
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%S %Z");
|
||||
print strfntime_local(0, "%Y-%m-%d %H:%M:%S %z");
|
||||
|
||||
}
|
||||
14
test/input/strpntime-tz.mlr
Normal file
14
test/input/strpntime-tz.mlr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
end {
|
||||
|
||||
print "---------------------------------------------------------------- TIMEZONE";
|
||||
print "TZ is", ENV["TZ"];
|
||||
|
||||
print "---------------------------------------------------------------- STRPNTIME";
|
||||
print strpntime("1970-01-01T00:00:00Z", "%Y-%m-%dT%H:%M:%SZ");
|
||||
print strpntime("1970-01-01T00:00:00.345Z", "%Y-%m-%dT%H:%M:%SZ");
|
||||
print strpntime("1970-01-01T00:00:00.345 UTC", "%Y-%m-%dT%H:%M:%S %Z");
|
||||
print strpntime("1970-01-01T00:00:00.345 EST", "%Y-%m-%dT%H:%M:%S %Z");
|
||||
print strpntime("1970-01-01T00:00:00.345 -0400", "%Y-%m-%dT%H:%M:%S %z");
|
||||
print strpntime("1970-01-01T00:00:00.345 +0400", "%Y-%m-%dT%H:%M:%S %z");
|
||||
|
||||
}
|
||||
9
test/input/strpntime_local-tz.mlr
Normal file
9
test/input/strpntime_local-tz.mlr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
end {
|
||||
|
||||
print "---------------------------------------------------------------- TIMEZONE";
|
||||
print "TZ is", ENV["TZ"];
|
||||
|
||||
print "---------------------------------------------------------------- STRPNTIME_LOCAL";
|
||||
print strpntime_local("1970-01-01 00:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue