OK, is it me or am I being thick.
Linux date command takes a -d argument which is very useful as it allows a description of the time you want.
e.g. date -d "5 minutes" done at 08:23:37 today gives Sun Dec 6 08:28:38 GMT 2009
Its really useful. You can even do things like date -d "next tuesday" which says Tue Dec 8 00:00:00 GMT 2009. I use it all the time.
But...
date -d "07:48 -1 minute" gives Sun Dec 6 07:50:00 GMT 2009
date -d "07:48 -2 minute" gives Sun Dec 6 07:51:00 GMT 2009
date -d "07:48 -3 minute" gives Sun Dec 6 07:52:00 GMT 2009
date -d "07:48 -4 minute" gives Sun Dec 6 07:53:00 GMT 2009
and...
date -d "07:48 +1 minute" gives Sun Dec 6 07:48:00 GMT 2009
date -d "07:48 +2 minute" gives Sun Dec 6 07:47:00 GMT 2009
date -d "07:48 +3 minute" gives Sun Dec 6 07:46:00 GMT 2009
date -d "07:48 +4 minute" gives Sun Dec 6 07:45:00 GMT 2009
Is it just me or is that kind of backwards...
Subscribe to:
Post Comments (Atom)
Deliveries from China
I have PCBs made in China (well Hong Kong). This is all my many small PCB projects (not FireBrick). I would rather use UK suppliers but I am...
-
Broadband services are a wonderful innovation of our time, using multiple frequency bands (hence the name) to carry signals over wires (us...
-
For many years I used a small stand-alone air-conditioning unit in my study (the box room in the house) and I even had a hole in the wall fo...
-
It seems there is something of a standard test string for anti virus ( wikipedia has more on this). The idea is that systems that look fo...
OK, it is me going mad. Someone has identified WTF it is doing!
ReplyDeleteThe +N or +N is seen as a time zone.
07:48 +4 means 07:49+0004 so takes 4 minutes off the time
The "minute" is seen as "add one minute"
To get +ve I just need N minute.
date -d "07:48 4 minute" is 07:52
To get -ve I just add "ago".
date -d "07:48 4 minute ago" is 07:44
Thanks for Simon on irc.