I need to do a C program where user will be able to change the system time.
I'm looking for this at some websites, but I can't find how to solve this.
How do I change the system time using C on Linux?
Any clue?
10x
I need to do a C program where user will be able to change the system time.
I'm looking for this at some websites, but I can't find how to solve this.
How do I change the system time using C on Linux?
Any clue?
10x
Are you running as root?
Yes, I am.
This is what I have:
time_t tiempovar;
struct tm * tmdvar;
time ( &tiempovar );
tmdvar = localtime ( &tiempovar );
tmdvar->tm_year = 2009 - 1900;
tmdvar->tm_mon = 5;
tmdvar->tm_mday = 26;
//struct tz * tzvar;
//settimeofday(*tmdvar, const struct timezone *tz);
http://www.manpagez.com/man/2/settimeofday/
The timezone is NULL, and you fill in a struct timeval and pass a pointer to it.
http://www.manpagez.com/man/2/settimeofday/
The timezone is NULL, and you fill in a struct timeval and pass a pointer to it.
How do I use "struct timezone" correctly?
Can you please include some code?
Thanks
Read the manual - it's not used, so passing NULL should work just fine.
Read the manual - it's not used, so passing NULL should work just fine.
I solved it.
I'll copy the code tomorrow.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.