Synchronize Time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* asctime example */
#include <stdio.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  printf ( "The current date/time is: %s", asctime (timeinfo) );
  
  return 0;
}


How i can make to display time from another computer? (exemple 94.62.18.167 linux server)
You should look for some information about socket programming. You should create a server program which listen on a port. The other program can connect to it and ask the time.
Check c++ socket programming in google.

http://www.google.hu/search?hl=hu&client=firefox-a&hs=dX6&rls=org.mozilla%3Aen-GB%3Aofficial&q=socket+programming+c%2B%2B&aq=f&aqi=&aql=&oq=&gs_rfai=

http://www.rites.uic.edu/~solworth/sockets.pdf

Topic archived. No new replies allowed.