« Yesterday / Tomorrow (in shell) | Main | Teamwork »

February 25, 2007

Yesterday / Tomorrow (in C for AIX)

Why does AIX have to be so different?

Oh well, this will do it:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
while (--argc)
int *i = (int *)atoi(argv[argc]) ;
(void) printf("%s %s", argv[argc], ctime(&i)) ;

You run this by giving it the epoch times as arguments. This can then be used with date +%s in some of the other articles in this series.


./ctime `date +%s`
1172183288 Fri Feb 23 09:28:08 2007

Posted by Ozguru at February 25, 2007 06:00 AM


Yes that is pre-ansi C.

So sue me.

When I learned to code, the only version of C was K&R (I still have my original autographed edition)...

Posted by: Ozguru [TypeKey Profile Page] at February 23, 2007 08:27 AM

Post a comment

Remember Me?

(you may use HTML tags for style)