This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-CC1350: Error in gmtime()

Part Number: LAUNCHXL-CC1350

Tool/software: Code Composer Studio

Hi,

I use ccs 7.1 and compiler TI v16.9.3.LTS.First I set the timestamp by Seconds_set(timestamp). Then I wanted to set local time eg gmtime (..). From the forum I learned that there is  _tz structure that stores timezone data. The default values are:

TZ _tz =
{
   -1,                      /* daylight */
   21600,                   /* timezone */
   "CST",                   /* tzname   */
   "DST",                   /* dstname  */
};
gmtime(..) gives date according to timezone (UTC+6). But when I change the timezone to negative gmtime shows an error (for CST should be -21600 !). The source of gmtime.c has the condition:

_CODE_ACCESS struct tm *GMTIME(const TIMET *timer)
{
    TIMET gtime = _tz.timezone; /* DIFFERENCE BETWEEN CURRENT TIME ZONE    */
                                /* AND GMT IN SECONDS                      */

    /*-----------------------------------------------------------------------*/
    /* If we overflow time_t by adding the timezone, return NULL             */
    /*-----------------------------------------------------------------------*/
#if defined(_TIME64_IMPLEMENTATION)
    if (*timer > INT64_MAX - gtime) return NULL;
#else
    if (*timer > UINT32_MAX - gtime) return NULL;
#endif

    if (timer) gtime += *timer;
    return LOCALTIME(&gtime);
}

When gtime < 0 there is overflow I think. How can I change this library? Is it true that DST(Daylight Saving Time) is not implemented?

JacekRz