[SWLUG] using 'date' with british summer time

bascule asura at theexcession.co.uk
Fri Nov 28 00:54:00 UTC 2003


hi dick
ah i see, 'stat --help' states: '%Y   Time of last modification as seconds 
since Epoch'
i took that to mean actual seconds, you're saying it's the number of seconds 
according to the local time?
anyway you mention:
TZ=GMT date
if you mean %T   time, 24-hour (hh:mm:ss)
well i avoided this to avoid the ':' which are illegal in fat16/32, i share 
some of my pics with others :)
i changed the timezone on my machine, i can get the local timezone appended to 
the output but i can't seem to get an actual UTC output - well, not without 
piping the output through some other process to compensate,
it's not a huge problem i'm just being a little niggardly i guess :)
oddly, i also can't explain the following results either:
[bascule at mycroft scripts]$ date -d '00:00:00 1970-01-01' +%s
-3600
[bascule at mycroft scripts]$ date -d '00:00:00 1970-01-01 UTC' +%s
0
[bascule at mycroft scripts]$ date -d '00:00:00 1970-01-01 BST' +%s
-3600
[bascule at mycroft scripts]$ date
Fri Nov 28 00:52:04 GMT 2003
[bascule at mycroft scripts]$
given that the current timezone is gmt how come i get -3600 for the first 
result?

bascule

On Thursday 27 Nov 2003 11:40 pm, Dick Porter wrote:
> On Thu, 2003-11-27 at 21:47, bascule wrote:
> > can someone suggest an alteration to force UTC output from 'date', the
> > only
>
> TZ=GMT date
>
> > option i can see for this seems to refer to setting the date,
> > as an example when i took photo in september and processed it immediately
> > after it was renamed to: 2003-09-05_23-25-16.avi
> > but just now when i ran the script it was renamed to:
> > 2003-09-06_00-25-16.avi the script runs from a temp directory holding a
> > copy of the files on the memory card
>
> The filesystem stores times in (milli)seconds-since-whenever (whenever
> depends on whether its a unix or dos filesystem.)  stat(1) reports the
> times in local time, so the current effects of daylight savings will
> influence the output.  You can see the same thing with ls -1, if you
> look at the same file before and after the clocks change.
>
> - Dick
>
-- 
In the words of one of the founding Igors: 'We belong dead? Ecthcuthe me? 
Where doeth it thay "we"?'
(The Thief of Time)





More information about the Swlug mailing list