0

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

2
Contributors
7
Replies
10
Views
8 Years
Discussion Span
Last Post by cesar7160
0

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);
1

Read the manual - it's not used, so passing NULL should work just fine.

Votes + Comments
Yes, he should RTFM!! And BTW: Nice link !!
0

Read the manual - it's not used, so passing NULL should work just fine.

I solved it.

I'll copy the code tomorrow.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.