test/sct_test_timescales.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Aleksander Morgado Juez                         *
00003  *   scitime@aleksander_morgado.mm.st                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <stdio.h>
00022 #include "scitime.h"
00023 
00024 
00031 int main(int argc, char** argv)
00032 {
00033     sct_time    epoch1;
00034     sct_time    epoch2;
00035     sct_time    delta;
00036     double      secs;
00037     double      mjd;
00038 
00039     printf("\n\n---------------------------------Test TAI-UTC conversion...\n");
00040     sct_set_mjd2000(&epoch1,0.0);   //Set date as 1 Jan 2000
00041     sct_copy(&epoch2,&epoch1);      //Copy epoch1 to epoch2
00042     sct_get_mjd(&epoch1, &mjd);     //Get mjd double from epoch1, to print
00043     printf("From MJD epoch '%lf' in TAI...\n", mjd);
00044     sct_from_TAI_to_UTC(&epoch2);   //Convert from TAI to UTC epoch2
00045     sct_get_mjd(&epoch2, &mjd);     //Get mjd double from epoch2, to print
00046     printf("To MJD epoch '%lf' in UTC...\n", mjd);
00047     sct_diff(&delta,&epoch2,&epoch1);   //Compute delta seconds between elements
00048     sct_get_delta_secs(&delta, &secs);
00049     printf("Seconds between elements: %lf\n", secs);
00050 
00051 
00052 
00053 
00054     return 0;
00055 }
00056 
00057 

Generated on Sun May 20 15:32:42 2007 for scitime by  doxygen 1.5.1