[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[LDM #NJE-906346]: LDM Log Time Zone Issue



Justin,

> The TZ variable was unset, so I made it UTC, restarted LDM, but the result
> is the same, the time stamp is in EST.
> 
> When I called 'date(1)' it returned UTC because that is the TZ setting for
> the entire system. To my knowledge nothing on the system has a setting of
> EST, that is what is making this LDM log date stamp issue very confusing to
> me...where and why is it being reset to EST?

Very odd.

Try this. Replace the file "src/ulog/Makefile.am" with the attached, new 
version and add the attached file "test_gmtime.c" to that same directory. Then 
go into the "src/ulog" directory and execute the command "make check". It 
should execute successfully and the current UTC time should be printed near the 
end of the output.

> Thanks,
> Justin

Regards,
Steve Emmerson

Ticket Details
===================
Ticket ID: NJE-906346
Department: Support LDM
Priority: Normal
Status: Closed

Attachment: Makefile.am
Description: Binary data

/**
 * Copyright 2012 University Corporation for Atmospheric Research.
 * See file ../COPYRIGHT for copying and redistribution conditions.
 *
 * This file is for testing the gmtime(3) function.
 *
 * Created on: Dec 10, 2012
 *     Author: Steven R. Emmerson
 */

#include <time.h>
#include <stdio.h>

int main()
{
    time_t      now;
    struct tm*  timestamp = 0;
    char        buf[256];

    (void)time(&now);

    timestamp = gmtime(&now);

    if (timestamp == 0) {
        perror("gmtime()");
        return 1;
    }

    (void)strftime(buf, sizeof(buf), "%b %d %H:%M:%S ", timestamp);
    puts(buf);

    return 0;
}