SUMMARY: porting a C program...

From: Marc Summers (marcs@tdd.hbo.nec.com)
Date: Tue Nov 10 1998 - 09:28:42 CST


Hello Sun SysAdmins

Thanks to all that sent in answers

Adamku, Ladislas
Derek Terveer
Randy J. Parker
Graham Leggett
Stefan Voss
David Mitchell
Andy J. Stefancik

it appears that
Andy J. Stefancik sent in the best, and allowed me in
just a very few minutes, to have a working answer.

Here is the finished program:

#define _REENTRANT
#include <stdio.h>
#include <time.h>

 
main(argc,argv)
int argc;
char *argv[];
{
 struct tm tim1;
 struct tm *stuff;
 time_t sec;

  sec=time(0);
  stuff = localtime_r(&sec,&tim1);

  fprintf(stdout,"%ld\n",sec);

  exit(0);
 
}/* END MAIN */

For those interested, this is what it looks like
for HP-UX 10.20

#include <stdio.h>
#include <time.h>

main(argc,argv)
int argc;
char *argv[];
{
  struct timeval first;
  struct timezone tzp;
  
  gettimeofday(&first,&tzp);
  fprintf(stdout,"%ld\n",first.tv_sec);

  exit(0);

}/* END MAIN */



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:52 CDT