Operating System - HP-UX
1837968 Members
2994 Online
110124 Solutions
New Discussion

Three C programs for your pleasure - Ctime

 
Joel Shank
Valued Contributor

Three C programs for your pleasure - Ctime

I had posted this on Friday, but it went away (I hope I am not breaking any rules, here, but they are my programs to give away if I want)

I have noticed several threads referring to time manipulation such as adding or subtracting days or months from a date, getting the difference between two dates, etc. I have written 3 C programs that act as commands that perform these functions that Iâ d like to share with the forum. They have been compiled on HPUX 10.20, 11.00 and 11I as well as AIX 4.1 and 4.3, with one minor modification (documented in the code). Since they all use standard UNIX header files, these should also compile on other UNIX flavors.

Since I can only attach one file per thread, I will make three threads, one for each program.

This program is Ctime and will add/subtract Years, Months, Weeks, Days, Hours, Minutes and/or Seconds from any date (default is current date). For example:
Ctime -2 Months
will display the date two months ago. It is very convenient and useful for some specific purposes.

I noticed that my other two postings had many wierd characters, probably because I tried to cut/paste from a word document, so I won't both doing that again here.

Space limitations prevent me from giving an expanded syntax, so look at the help output or read the code. Ctime -h display the full command syntax.

Hope you find this as useful as I have.

Enjoy!
j
1 REPLY 1
Robert-Jan Goossens
Honored Contributor

Re: Three C programs for your pleasure - Ctime

Hi Joel,

You can post scripts utilities in this thread.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=178514

Regards and good luck,

Robert-Jan