On Fri, 29 Feb 2008, Bob Proulx wrote:
Jan Engelhardt wrote:
I wanted to get the number of seconds since the start of the day.
echo $[`date +%s` % 86400];
unfortunately does not do the right thing ÿÿ it would show
82800 instead of 0 when it is (local) midnight.
I can't think of any totally race free way to do this without invoking
date multiple times.
I might be misunderstanding the problem, but it seems easy enough to do
this calling date only once:
$ date +%T | awk -F: '{ print $1 * 3600 + $2 * 60 + $3 }'
67652
(corresponding to 18:47:32)
Cheers,
Phil
_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils