<% set error "" set output "" array set q { humantime now } if {[ns_getform] != ""} { getform q set code [catch { set utime [clock scan $q(humantime) -gmt 1] } result] if {$code == 1} { set error "Error: [ns_quotehtml $result]" } else { set tai64n [format "@40000000%08x00000000" $utime] set UTC_time [exec /bin/sh -c "echo $tai64n | TZ=right/UTC tai64nlocal"] regsub {\.[0-9]*$} $UTC_time {} UTC_time set tai64n [format "@40000000%08x00000000" [expr {$utime + 10}]] set TAI_time [exec /bin/sh -c "echo $tai64n | TZ=TAI tai64nlocal"] regsub {\.[0-9]*$} $TAI_time {} TAI_time set tai64 [format "@40000000%08x" $utime] set output "" append output "Your external TAI64 timestamp is $tai64," append output "which means" append output "
[ns_quotehtml $TAI_time] TAI and\n" append output "
[ns_quotehtml $UTC_time] UTC.\n" } } %> tinydns Timestamp Maker

tinydns Timestamp Maker

by Rob Mayoff
<%= $error %> <%= $output %>

Each line in the tinydns data file may have a timestamp associated with it. See the tinydns-data documentation for details.

This form allows you to compute an external TAI64 timestamp for a specified date and time. This is the format that you must use in your data file.

Enter a date and time in a format acceptable to the clock scan command described here. If you do not enter a time zone, then this program uses TAI. If you enter a time zone, this program gets the time wrong by 10 seconds. Argh. I'll fix it eventually.

"%> TAI date and time: <%=[html::text humantime $q(humantime)]%>

Example times you can enter: