head 1.3; access ; symbols ; locks oasisa:1.3; strict; comment @ * @; 1.3 date 2002.03.01.15.39.08; author oasisa; state Exp; branches ; next 1.2; 1.2 date 2001.06.19.13.25.57; author oasisa; state Exp; branches ; next 1.1; 1.1 date 2001.06.19.13.06.14; author oasisa; state Exp; branches ; next ; desc @Periodic Update w/ changes to utils plus new utils 6/19/2001 (klh) @ 1.3 log @sync w/ WIN32 @ text @/****************************************************************************/ /* Copyright (C) 2001 MBARI */ /* Author: Kent Headley */ /****************************************************************************/ /* */ /* MBARI provides this documentation and code "as is", with no warranty, */ /* express or implied, of its quality or consistency. It is provided without*/ /* support and without obligation on the part of the Monterey Bay Aquarium */ /* Research Institute to assist in its use, correction, modification, or */ /* enhancement. This information should not be published or distributed to */ /* third parties without specific written permission from MBARI. */ /* */ /****************************************************************************/ #include /* Standard I/O */ #include /* For exit() */ #include /* MBARI type definitions */ #include /* MBARI constants */ #include /* Time */ #include #include #include #define LOCAL 0 #define EQPAC 1 Extern char *optarg; /* Option argument from getopt() */ Extern Int optind; /* Option index from getopt() */ #ifdef WIN32 Extern Int getopt( Int argc, char *const *argv, const char *fmt ); #endif int location=LOCAL; int firstarg; MBool process_command_line ( Int argc, char **argv ); Void use_msg( char *s ); main(argc,argv) int argc; char *argv[]; { int i,iday,iyear; double year,day,hour,min,sec; double ip; double days_per_year; if ( !process_command_line(argc, argv) ) { use_msg(argv[0]); exit( 1 ); } if(location == EQPAC) for(i=firstarg;i=1){ if(year<0)year*=(-1.0); modf(year,&ip); iyear=(int)ip; days_per_year=(iyear%4==0)?366:365; day =(modf(year,&ip))*(days_per_year); year=ip; hour =(modf(day,&ip))*24; day=ip; min =(modf(hour,&ip))*60; hour=ip; sec =(modf(min,&ip))*60; min=ip; printf("%3.0lf %02.0lf:%02.0lf:%03.1lf\n",day,hour,min,sec); } }/*end for...EQPAC*/ if(location == LOCAL) for(i=firstarg;i=1){ if(day<0)day*=(-1.0); modf(day,&ip); iday=(int)ip; hour =(modf(day,&ip))*24; day=ip; min =(modf(hour,&ip))*60; hour=ip; sec =(modf(min,&ip))*60; min=ip; printf("%3.0lf %02.0lf:%02.0lf:%03.1lf\n",day,hour,min,sec); } }/*end for...LOCAL*/ return 0; } /************************************************************************/ /* Function : process_command_line */ /* Purpose : Read the arguments from the command line */ /* Inputs : argc, argv from main() routine */ /* Outputs : TRUE if arguments OK, else FALSE */ /************************************************************************/ MBool process_command_line ( argc, argv ) Int argc; char **argv; { Int i; location = LOCAL; while ( (i = getopt(argc, argv, "el")) != EOF ) switch( i ) { case 'e': location = EQPAC; firstarg=2; break; case 'l': location = LOCAL; firstarg=2; break; default: return( FALSE ); } return( TRUE ); } /* process_command_line() */ /************************************************************************/ /* Function : use_msg */ /* Purpose : Print Usage Message */ /* Inputs : Name of program */ /* Outputs : None */ /************************************************************************/ Void use_msg( s ) char *s; { fprintf( stderr, "Usage: %s [-e] [-l] timestamp [timestamp]...\n", s ); fprintf( stderr, "-e EQPAC time stamp (decimal year)\n"); fprintf( stderr, "-l LOCAL time stamp (decimal day of year)\n"); } /* use_msg() */ @ 1.2 log @Added header, rev, logs @ text @a1 2 /* $Header$ */ /* $Revision$ */ a14 3 /* $Log$ */ d28 5 a32 1 Extern Int optind; /* Option index from getopt() */ d88 1 a88 1 @ 1.1 log @Initial revision @ text @d2 2 d16 3 @