static void printer_cups_get_printjob_name(char* buf, size_t size, size_t id)
{
time_t tt;
+ struct tm tres;
struct tm* t;
tt = time(NULL);
- t = localtime(&tt);
+ t = localtime_r(&tt, &tres);
sprintf_s(buf, size - 1, "FreeRDP Print %04d-%02d-%02d %02d-%02d-%02d - Job %" PRIdz,
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, id);
}
static WCHAR* printer_win_get_printjob_name(size_t id)
{
time_t tt;
+ struct tm tres;
struct tm* t;
WCHAR* str;
size_t len = 1024;
int rc;
tt = time(NULL);
- t = localtime(&tt);
+ t = localtime_r(&tt, &tres);
str = calloc(len, sizeof(WCHAR));
if (!str)
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
{
time_t ct = 0;
+ struct tm tres;
struct tm* ltm = NULL;
WORD wMilliseconds = 0;
ct = time(NULL);
wMilliseconds = (WORD)(GetTickCount() % 1000);
- ltm = localtime(&ct);
+ ltm = localtime_r(&ct, &tres);
ZeroMemory(lpSystemTime, sizeof(SYSTEMTIME));
if (ltm)
DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
{
time_t t;
+ struct tm tres;
+ ;
struct tm* local_time;
TIME_ZONE_ENTRY* dtz;
LPTIME_ZONE_INFORMATION tz = lpTimeZoneInformation;
lpTimeZoneInformation->StandardBias = 0;
time(&t);
- local_time = localtime(&t);
+ local_time = localtime_r(&t, &tres);
+ if (!local_time)
+ goto out_error;
+
memset(tz, 0, sizeof(TIME_ZONE_INFORMATION));
#ifdef HAVE_TM_GMTOFF
{