Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

time_t c++ stack overflow

time_t mktimeUTC(struct tm* timeinfo)
{
    // *** enter in UTC mode
    char* oldTZ = getenv("TZ");
    putenv("TZ=UTC");
    _tzset();
    // ***

    time_t ret = mktime ( timeinfo );

    // *** Restore previous TZ
    if(oldTZ == NULL)
    {
        putenv("TZ=");
    }
    else
    {
        char buff[255];
        sprintf(buff,"TZ=%s",oldTZ);
        putenv(buff);
    }
    _tzset();
    // ***

    return ret;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #stack #overflow
ADD COMMENT
Topic
Name
8+9 =