#include #include #include "SpiceUsr.h" int main( int argc, char * argv[] ) { SpiceInt scid; SpiceDouble et; SpiceChar utc [32]; SpiceChar lmst[32]; /* Get command line. Display usage if it doesn't contain four arguments. */ if ( argc != 5 ) { printf ( " \n" ); printf ( " Example program illustrating using SPICE SCLK file and\n" ); printf ( " to do PHX UTC-to-LMST and LMST-to-UTC conversions. \n" ); printf ( " \n" ); printf ( " Usage: \n" ); printf ( " \n" ); printf ( " > sclk_lmst_example metakernel scname type time \n" ); printf ( " \n" ); printf ( " where: \n" ); printf ( " \n" ); printf ( " metakernel ... file listing LSK and LMST SCLK files\n" ); printf ( " scname ........'phx' \n" ); printf ( " type ..........'lmst' or 'utc' \n" ); printf ( " time ..........YYYY-MM-DDTHR:MN:SC or DDD:HR:MN:SC \n" ); printf ( " \n" ); return(1); } /* The first command line argument is the name of a meta-kernel file. Load this file using furnsh_c. */ furnsh_c( argv[1] ); /* The seconds argument in the rover name. Based on it, set ID to be used in SCLK function calls. */ if ( ! strcmp( argv[2], "phx" ) ) { scid = -84900; } else { printf ( " ERROR: cannot recognize s/c name %s.\n", argv[2] ); return(1); } /* The kind of conversion LMST->UTC or back is determined by the third command line argument. */ if ( ! strcmp( argv[3], "lmst" ) ) { /* Convert LMST to UTC. */ scs2e_c ( scid, ( ConstSpiceChar * ) argv[4], &et ); timout_c( et, "YYYY-MM-DDTHR:MN:SC.###", 32, utc ); printf ( "%s (UTC)\n", utc ); } else if ( ! strcmp( argv[3], "utc" ) ) { /* Converting UTC to LMST. */ str2et_c( ( ConstSpiceChar * ) argv[4], &et ); sce2s_c ( scid, et, 32, lmst ); printf ( "%s (LMST)\n", lmst ); } else { printf ( " ERROR: cannot recognize input time type %s.\n", argv[3] ); return(1); } return(0); }