Operating System - HP-UX
1833515 Members
3182 Online
110061 Solutions
New Discussion

Three C programs for your pleasure - TimeStamp

 
Joel Shank
Valued Contributor

Three C programs for your pleasure - TimeStamp


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 TimeStamp.

TimeStamp performs several different date conversions, depending on the options used.

TimeStamp issued without any arguments prints the timestamp of the current date.

TimeStamp â H

prints the command syntax and exits.

The general syntax of TimeStamp is:

TimeStamp [-B] [-R opt] [-J] [-j]
[-n] [-t timestamp]
[-d â date-stringâ ]
[-M mon] [-D day] [-Y year]
[-h hour] [-m minute] [-s second]

TimeStamp â S [year]
This form creates a Holiday Accounting file for the specified year (default is current year), if you are using HP's accounting routine.

Space limitations prevent me from giving an expanded syntax, so look at the help output or read the code.

Hope you find this as useful as I hav
1 REPLY 1
RAC_1
Honored Contributor

Re: Three C programs for your pleasure - TimeStamp

I would try those. Thanks for contribution to the forum.

Anil
There is no substitute to HARDWORK