%
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"
}
}
%>
<%= $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.
<%="
Example times you can enter:
<%
foreach time {
{now}
{5 days 12 hours}
{2 weeks}
{1970-01-01 00:00:00}
{1992-06-02 08:07:09}
{2005-07-15 14:30:00}
} {
ns_adp_puts "- [ns_quotehtml $time]
"
}
%>