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

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

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

commented: Yes, he should RTFM!! And BTW: Nice link !! +7

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

I solved it.

I'll copy the code tomorrow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.