From: David C. <cl...@au...> - 2004-01-28 00:27:11
|
Yes -- you can find the GNU date command in the "sh-utils" package: ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/sh-utils/sh-utils-2.0-10.aix5.1.ppc.rpm Or if you are still on 4.3.3: ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/sh-utils/sh-utils-2.0-10.aix4.3.ppc.rpm Because it has the same name as the native AIX date command, you can invoke it as /usr/linux/bin/date or /opt/freeware/bin/date or set your path to find that version before /usr/bin or /bin. On Tue, Jan 27, 2004 at 03:07:52PM -0600, Westphal, Raymond W wrote: > Hello AIXers! > > I was looking through Google AIX group for a Perl script to display > epoch time. I found reference to a GNU version of date. > > To find epoch time: > > $ perl -e 'print time()' > > To find time so far ago or in the future via actual passed seconds > (86400 seconds a day). Calculating a DAY to be 86400 seconds works > most of the time, but there are times it breaks (daylight savings, etc). > A more robust applicatoin would be GNU date. > > $ perl -e 'print $time = (localtime (time + (86400 * -1))),"\n";' > # ^ -1 day (past) > # Pos = future > # Neg = past > > OR > > Try GNU date... it does exactly what your asking w/out converting back > and forth > > /pub/gnu/bin/date -d "30 days ago" > using different output options (%s say) gives you epoch, > > as one would expect, the GNU version is much more robust than the > base OS version; > > Is the GNU date included in any of your GNU utilities? > > Thanks in advance! > > Ray Westphal. -- David Clissold cl...@au... |