diff --git a/c/timeconv_test/timeconv_test.c b/c/timeconv_test/timeconv_test.c index ee628c0..c840c79 100644 --- a/c/timeconv_test/timeconv_test.c +++ b/c/timeconv_test/timeconv_test.c @@ -5,13 +5,13 @@ #include "timeconv.h" -void conv_test() +void pack_conv_test() { struct tm t; struct timeval tv; struct timespec ts; struct timecent tc; - struct timemil tl; + struct timemils tl; uint64_t pack64 = 0; char buf[256]; size_t i = 0; @@ -48,10 +48,10 @@ void conv_test() memset(&tc, 0, sizeof(tc)); tc = timecent_from_csec(pack64); break; - case 3: pack64 = msec_from_timemil(tl); + case 3: pack64 = msec_from_timemils(tl); tl.tv_msec = 798431; memset(&tl, 0, sizeof(tl)); - tl = timemil_from_msec(pack64); + tl = timemils_from_msec(pack64); break; default:; } @@ -60,9 +60,37 @@ void conv_test() } } +void struct_conv_test() +{ + struct timeval tv; + struct timespec ts; + struct timecent tc; + struct timemils tl; + + tv = timeval_from_timespec(ts); + ts = timespec_from_timeval(tv); + + tv = timeval_from_timecent(tc); + tc = timecent_from_timeval(tv); + + tv = timeval_from_timemils(tl); + tl = timemils_from_timeval(tv); + + ts = timespec_from_timecent(tc); + tc = timecent_from_timespec(ts); + + ts = timespec_from_timemils(tl); + tl = timemils_from_timespec(ts); + + tc = timecent_from_timemils(tl); + tl = timemils_from_timecent(tc); +} + int main(int argc, char *argv[]) { - conv_test(); + pack_conv_test(); + + struct_conv_test(); return 0; }