00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include "scitime.h"
00023
00024 #define MAX_DATES 6
00025 #define MAX_SECS 8
00026
00032 int main(int argc, char** argv)
00033 {
00034 SCT_ACCURACY accuracy;
00035 double dates [MAX_DATES];
00036 double secs [MAX_SECS];
00037 sct_time epoch1;
00038 sct_time epoch2;
00039 sct_time delta;
00040 int ind;
00041
00042 printf("\n\n---------------------------Test Getting accuracy from JD...\n");
00043 dates[0] = 1.0;
00044 dates[1] = 10.0;
00045 dates[2] = 100.0;
00046 dates[3] = 1.0E20;
00047 dates[4] = -1.0E20;
00048 dates[5] = 1.0E-20;
00049 for(ind = 0; ind < MAX_DATES; ind++)
00050 {
00051 accuracy = sct_get_accuracy_from_jd(dates[ind]);
00052 printf("For date '%.20lE', accuracy is '%d'\n",dates[ind],(int)accuracy);
00053 }
00054
00055 printf("\n\n-------------------------Test Getting accuracy from secs...\n");
00056 secs[0] = 1.0;
00057 secs[1] = 1234.2;
00058 secs[2] = 1.1234567890;
00059 secs[3] = 1.123456789012345;
00060 secs[4] = 1.12345678901234567890;
00061 secs[5] = 1234567890.1234567890;
00062 secs[6] = 1E20;
00063 secs[7] = 1E-20;
00064 for(ind = 0; ind < MAX_SECS; ind++)
00065 {
00066 accuracy = sct_get_accuracy_from_secs(secs[ind]);
00067 printf("For secs '%.20lE', accuracy is '%d'\n",secs[ind],(int)accuracy);
00068 }
00069
00070 printf("\n\n-------------------------Test scitime elements diff...\n");
00071 printf("Diff between a MJD2000 stored with automatic accuracy and a MJD2000"
00072 " with explicit accuracy set to SECS...\n");
00073 sct_set_mjd2000(&epoch1, 0.0);
00074 sct_set_mjd2000(&epoch2, 0.5);
00075 sct_set_accuracy(&epoch2, SCT_ACCURACY_SECS);
00076 sct_diff(&delta, &epoch1, &epoch2);
00077
00078 printf("\n\n-------------------------Test scitime elements add...\n");
00079 printf("MJD2000 stored with automatic accuracy being added 15 femtosecs\n");
00080 sct_set_mjd2000(&epoch1, 0.0);
00081 sct_add_deltaDSF(&epoch1, &epoch1, 0, 0, 15);
00082
00083 printf("\n\n");
00084 return 0;
00085 }
00086