This morning, as I was glancing through the new (November) issue of Linux Journal, I found a tech tip introducing the showdate program: it will give you the date (i.e. day, month, and year, and even time) corresponding to an offset (into the past or the future) respective to the current time. Some examples are given below. You can obtain a copy of the source here. Extract and rename the file to showdate.c (if needed) and then compile it like this:

gcc showdate.c -o showdate

It should compile without any warning or error. Then, if you run the program without any options, you should get something like this:

usage: showdate
[-y [+|-]years]
[-m [+|-]months]
[-d [+|-]days]
[-h [+|-]hours]
[-M [+|-]minutes]
[-s [+|-]seconds]
[-e | -f format]

Now for instance, if you want to now the date of 5 years and 2 months into the future, you do like this (the first command is to show the current time):

$ ./showdate -m 0
Tue Oct 16 11:55:50 2007
$ ./showdate -y 5 -m 2
Sun Dec 16 10:55:55 2012

A couple more of trials should familiarize with the application. Pretty neat, ãh?


Os comentários estão fechados.