Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c get time in milliseconds

#include <sys/time.h>

long long current_timestamp() {
    struct timeval te; 
    gettimeofday(&te, NULL); // get current time
    long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; // calculate milliseconds
    // printf("milliseconds: %lld
", milliseconds);
    return milliseconds;
}
 
PREVIOUS NEXT
Tagged: #time #milliseconds
ADD COMMENT
Topic
Name
7+3 =