136fd0130Shoumkh #include <sys/time.h> 236fd0130Shoumkh #include <stdio.h> 336fd0130Shoumkh #include <stdlib.h> 436fd0130Shoumkh #include <unistd.h> 536fd0130Shoumkh #include <time.h> 636fd0130Shoumkh main()736fd0130Shoumkhint main() 836fd0130Shoumkh { 936fd0130Shoumkh struct timeval *tv = malloc(sizeof(struct timeval)); 10*b8ed3825SDonkey Kane struct timezone *tz = malloc(sizeof(struct timezone)); 11*b8ed3825SDonkey Kane for (int i = 0; i < 15; i++) 12*b8ed3825SDonkey Kane { 13*b8ed3825SDonkey Kane gettimeofday(tv, NULL); 14*b8ed3825SDonkey Kane printf("%ld.%06ld\n", tv->tv_sec, tv->tv_usec); 15*b8ed3825SDonkey Kane for (int i = 0; i < 10; i++) 16*b8ed3825SDonkey Kane { 17*b8ed3825SDonkey Kane usleep(500000); 18*b8ed3825SDonkey Kane } 19*b8ed3825SDonkey Kane } 2036fd0130Shoumkh gettimeofday(tv, NULL); 2136fd0130Shoumkh printf("tv = %ld.%06ld\n", tv->tv_sec, tv->tv_usec); 2236fd0130Shoumkh // printf("tz_minuteswest = %d,tz_dsttime = %d", (*tz).tz_minuteswest, (*tz).tz_dsttime); 2336fd0130Shoumkh return 0; 2436fd0130Shoumkh }