1 # some routines taken from wiki.pl to help debug: it translates Perl
2 # times into human readable times
5 my ($sec, $min, $hour, $mday, $mon, $year) = gmtime(shift);
6 return sprintf('%4d-%02d-%02d', $year+1900, $mon+1, $mday);
10 my ($sec, $min, $hour, $mday, $mon, $year) = gmtime(shift);
11 return sprintf('%02d:%02d:%02d UTC', $hour, $min, $sec);
17 return Ts
('%s hours ago',int($total/3600));
18 } elsif ($total >= 3600) {
19 return T
('1 hour ago');
20 } elsif ($total >= 120) {
21 return Ts
('%s minutes ago',int($total/60));
22 } elsif ($total >= 60) {
23 return T
('1 minute ago');
24 } elsif ($total >= 2) {
25 return Ts
('%s seconds ago',int($total));
26 } elsif ($total == 1) {
27 return T
('1 second ago');
35 return CalcDay
($t) . ' ' . CalcTime
($t);
38 # Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg
39 # 1997-07-16T19:20+01:00)
41 my ($sec, $min, $hour, $mday, $mon, $year) = gmtime(shift);
42 # use special UTC designator ("Z")
43 return sprintf('%4d-%02d-%02dT%02d:%02dZ', $year+1900, $mon+1, $mday, $hour, $min);
47 my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime(shift);
48 # Sat, 07 Sep 2002 00:00:01 GMT
49 return sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT",
50 qw(Sun Mon Tue Wed Thu Fri Sat)[$wday], $mday,
51 qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[$mon],
52 $year+1900, $hour, $min, $sec);
56 s/(\d\d\d\d\d+)/TimeToText($1)/ge;