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
00030 int main(int argc, char** argv)
00031 {
00032
00033 sct_time elem1;
00034 unsigned int year;
00035 unsigned int month;
00036 unsigned int day;
00037 unsigned int hour;
00038 unsigned int minute;
00039 unsigned int second;
00040 u_int64_t femtposec;
00041 double mjd;
00042 double mjd2000;
00043 double jd;
00044
00045 printf("---------------------------Test SET/GET YMDHMSN...\n");
00046 year = 2000;
00047 month = 1;
00048 day = 3;
00049 hour = 1;
00050 minute = 0;
00051 second = 15;
00052 femtposec = 45;
00053
00054 printf("From [%u/%u/%u %u:%u:%u:%llu]\n", year, month, day, hour, minute, \
00055 second, femtposec);
00056 sct_set_YMDHMSF(&elem1, year, month, day, hour, minute, second, femtposec);
00057
00058 sct_print(&elem1);
00059
00060 sct_get_YMDHMSF (&elem1, &year, &month, &day, &hour, &minute, &second, \
00061 &femtposec);
00062 printf("To [%u/%u/%u %u:%u:%u:%llu]\n\n", year, month, day, hour, minute, \
00063 second, femtposec);
00064
00065
00066
00067 printf("---------------------------Test SET/GET YMDHMSN...\n");
00068 year = 2000;
00069 month = 1;
00070 day = 3;
00071 hour = 23;
00072 minute = 0;
00073 second = 15;
00074 femtposec = 45;
00075
00076 printf("From [%u/%u/%u %u:%u:%u:%llu]\n", year, month, day, hour, minute, \
00077 second, femtposec);
00078 sct_set_YMDHMSF(&elem1, year, month, day, hour, minute, second, femtposec);
00079
00080 sct_print(&elem1);
00081
00082 sct_get_YMDHMSF (&elem1, &year, &month, &day, &hour, &minute, &second, \
00083 &femtposec);
00084 printf("To [%u/%u/%u %u:%u:%u:%llu]\n\n", year, month, day, hour, minute, \
00085 second, femtposec);
00086
00087
00088
00089
00090 printf("---------------------------Test SET/GET mjd2000...\n");
00091 mjd2000 = 0.5;
00092
00093 printf("From [%lf]\n", mjd2000);
00094 sct_set_mjd2000(&elem1, mjd2000);
00095
00096 sct_print(&elem1);
00097
00098 sct_get_mjd2000(&elem1, &mjd2000);
00099 printf("To [%lf]\n\n", mjd2000);
00100 sct_get_YMDHMSF (&elem1, &year, &month, &day, &hour, &minute, &second, \
00101 &femtposec);
00102 printf("To [%u/%u/%u %u:%u:%u:%llu]\n\n", year, month, day, hour, minute, \
00103 second, femtposec);
00104
00105
00106
00107 printf("---------------------------Test SET/GET mjd...\n");
00108 year = 2000;
00109 month = 1;
00110 day = 3;
00111 hour = 23;
00112 minute = 0;
00113 second = 15;
00114 femtposec = 45;
00115
00116 printf("From [%u/%u/%u %u:%u:%u:%llu]\n", year, month, day, hour, minute, \
00117 second, femtposec);
00118 sct_set_YMDHMSF(&elem1, year, month, day, hour, minute, second, femtposec);
00119
00120 sct_print(&elem1);
00121
00122 sct_get_mjd(&elem1, &mjd);
00123 printf("To MJD [%lf]\n\n", mjd);
00124 sct_get_YMDHMSF (&elem1, &year, &month, &day, &hour, &minute, &second, \
00125 &femtposec);
00126 printf("To [%u/%u/%u %u:%u:%u:%llu]\n\n", year, month, day, hour, minute, \
00127 second, femtposec);
00128
00129
00130
00131
00132 printf("---------------------------Test SET/GET jd...\n");
00133 jd = 2454219.02804;
00134
00135 printf("From [%lf]\n", jd);
00136 sct_set_jd(&elem1, jd);
00137
00138 sct_print(&elem1);
00139
00140 sct_get_jd(&elem1, &jd);
00141 printf("To [%lf]\n\n", jd);
00142 sct_get_YMDHMSF (&elem1, &year, &month, &day, &hour, &minute, &second, \
00143 &femtposec);
00144 printf("To [%u/%u/%u %u:%u:%u:%llu]\n\n", year, month, day, hour, minute, \
00145 second, femtposec);
00146
00147
00148
00149
00150 return 0;
00151 }
00152