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)
Microwave plates
We have many plates. They work as plates. They are fine in the microwave. But not this fucking plate. I have blisters on my fingers from pic...
-
This is an appeal for (sensible) comments. I am working on revised A&A tariffs for broadband. For those that are not sure how they wor...
-
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...
-
Broadband services are a wonderful innovation of our time, using multiple frequency bands (hence the name) to carry signals over wires (us...
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.