porting a C program...

2007-12-25 11:46:00

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 */

Comments

Got something to say?

You must be logged in to post a comment.