In the analysis of live555CodeOccasional acquisition:
If (fisfirstpacket) {// record the fact that we're starting to play now: gettimeofday (& fnextsendtime, null );}
UNIX and Linux time systems start from epoch, in seconds. Epoch is the Greenwich Mean Time (Greenwich Mean Time) specified at 00:00:00, January 1, January 1, 1970. At present, most Unix systems use 32-bit to record time. Positive values are expressed after 1970, and negative values are expressed before 1970.
Next let's take a look at the time function in time. h, and the gettimeofday function in sys/time. h.
# Include <time. h>
# Include <sys/time. h>
# Include <stdio. h>
Int main (){
Time_t tt;
Struct timeval TV;
TT = Time (null );
Gettimeofday (& TV, null );
Printf ("time_t sec is % d \ n", TT );
Printf ("gettimeofday TV _sec is % d, USEC is % d \ n", TV. TV _sec, TV. TV _usec );
}
PS: the time and gettimeofday functions get the number of seconds from epoch to the current one (TT = TV. TV _sec), and the latter can get more precise results in microseconds, that is, TV _sec * (10 ^ 6) + TV _usec is the number of microseconds from epoch to the current