Subject: Re: TZ and unix epoc
To: None <tech-kern@NetBSD.org>
From: George Georgalis <george@galis.org>
List: tech-kern
Date: 02/27/2006 12:58:29
On Mon, Feb 27, 2006 at 12:58:09PM -0500, Chapman Flack wrote:
>>On Sun, Feb 26, 2006 at 06:10:16PM -0500, George Georgalis wrote:
>>>Right, but that's not what I meant to ask for. I meant, in a
>>>specified timezone (specifically -0200), what are the unix
>>>seconds at the start of the present day (second zero), in linux
>>>that would be "date -d 0" for any given TZ or print format you
>>>set.
>
>I may not have noticed this thread early enough to be sure exactly
>what you want to do, but if using ksh is an option (not pdksh), is
>this close to what you want?  (I am in Eastern Std. Time)
>
>$ printf $'%(%s)T\n' today
>1141016400
>$ printf $'%(%s)T\n' 'today EST'
>1141016400
>$ printf $'%(%s)T\n' 'today GMT'     
>1140998400
>$ printf $'%(%s)T\n' 'today GMT-0200'   
>1141005600
>$ printf $'%T\n' '#1141016400'
>Mon Feb 27 00:00:00 EST 2006
>
>Because it only uses printf, a ksh builtin, it may be a smidge
>faster than solutions that fork date, dc, etc.

nice! however, 

$ printf $'%(%s)T\n' today
printf: %(: invalid directive

but I thought I was using the program you describe, vs
/usr/pkgsrc/shells/pdksh

$ which ksh
/bin/ksh
$ echo $KSH_VERSION
@(#)PD KSH v5.2.14 99/07/13.2

...guess not. Where are you getting the working ksh?

// George

-- 
George Georgalis, systems architect, administrator <IXOYE><
http://galis.org/ cell:646-331-2027 mailto:george@galis.org