Hello there!
I've built a simple server and a simple client in C (Linux).
Among other tasks, I need the server to send the timestamp (using time.h) to the client.
Then I need the client to change the system time based on the timestamp received from the server.
What would be the best way?
I already get the timestamp in the client, but as a string after using asctime, this way:
time_t now;
struct tm* myTime;
now = time(NULL);
myTime = localtime(&now);
strcpy(msgTime, asctime(myTime));
int msgSize = strlen(msgTime);
send(sockCli, msgTime, msgSize, 0);
But this is just a string...
Is there a way of receiving the number of seconds in the client and thus making it a lot easier to do time operations? How?
Thank you for any hints!