Re: [clock scan] weirdness
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: [clock scan] weirdness

From: ljb <ljb220@mindspring.com.no.spam>
Date: Thu Apr 27 2006 - 04:20:47 CEST

ytyourclothes@p.zapto.org wrote:
> OK, I'm just kinda baffled by all this:
>
> (Tcl) 54 % puts $tcl_patchLevel
> 8.4.12
> (Tcl) 55 % clock format [clock scan "2005-08-05 14:20:09"]
> Fri Aug 05 2:20:09 PM Pacific Standard Time 2005
> (Tcl) 56 % clock format [clock scan "2005-08-05 14:20:09 +1"]
> unable to convert date-time string "2005-08-05 14:20:09 +1"
> (Tcl) 57 % clock format [clock scan "2005-08-05 14:20:09 i1"]
> Sun Aug 05 4:20:09 PM Pacific Standard Time 2001
> (Tcl) 58 % clock format [clock scan "2005-08-05 14:20:09 -1"]
> Fri Aug 05 7:21:09 AM Pacific Standard Time 2005
> (Tcl) 59 % clock format [clock scan "2005-08-05 14:20:09 x1"]
> Sat Aug 04 8:20:09 PM Pacific Standard Time 2001
> (Tcl) 60 % clock format [clock scan "2005-08-05 14:20:09 - 1 hour"]
> Fri Aug 05 8:21:09 AM Pacific Standard Time 2005
> (Tcl) 61 % clock format [clock scan "2005-08-05 14:20:09 + 1 hour"]
> Fri Aug 05 3:20:09 PM Pacific Standard Time 2005
>
> I'm sure there's a rational explanation why 14-1=8 and why "-1" and
> "x1" and "i1" are allowed but "+1" isn't and why "-1hour" subtracts
> 5:59 while "-1" subtracts 6:59 and why "i1" adds two hours but
> subtracts 4 years and so on but... I sure as hell don't see the
> pattern...

Rational, I'm not sure, but here it is anyway. Well, some of it.

"2005-08-05 14:20:09 -1"
The -1 means a timezone of 1 minute before UTC, which is 06:59 before your
time zone.

"2005-08-05 14:20:09 - 1 hour"
Very misleading. -1 is used as above to select a timezone UTC-0001, resulting
in -6:59 adjustment, and then you add an (implied 1) hour offset from that.
It is as if you wrote: "2005-08-05 14:20:09 -0001 +1 hour"

"2005-08-05 14:20:09 x1", "2005-08-05 14:20:09 i1"
Single letters a-z refer to military timezones. z is UTC, x is UTC-11 hours,
and i is UTC+9 hours.
The bare number "1" here resets the year, subject to Y2K disambiguation
to get 2001. Odd to override the year when it was already given, but it is
meant for cases like: "08/05 14:20:09 2005".
Received on Sun Apr 30 03:27:33 2006