Skip to content

Instantly share code, notes, and snippets.

@jj1bdx
Created December 19, 2010 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jj1bdx/747334 to your computer and use it in GitHub Desktop.
Save jj1bdx/747334 to your computer and use it in GitHub Desktop.
An old standalone C code for executing gettimeofday() and settimeofday() system calls for *BSD
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
int main(int argc, char **argv)
{
struct timeval t;
struct timezone tz;
if (-1 == gettimeofday(&t, &tz)) {
perror("resettimeofday: gettimeofday");
exit(-1);
}
if (-1 == settimeofday(&t, &tz)) {
perror("resettimeofday: settimeofday");
exit(-1);
}
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment