Commit 9a583763 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

msvcrt: Implemented wctime(), wasctime().

Free thread data in DLL_THREAD_DETACH.
parent 9f34fd37
......@@ -70,6 +70,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_THREAD_DETACH:
/* Free TLS */
tls = TlsGetValue(msvcrt_tls_index);
HeapFree(GetProcessHeap(),0,tls->efcvt_buffer);
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
HeapFree(GetProcessHeap(), 0, tls);
TRACE("finished thread free\n");
break;
......
......@@ -83,6 +83,7 @@ struct __thread_data {
unsigned long thread_doserrno;
unsigned char *mbstok_next; /* next ptr for mbstok() */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
MSVCRT_wchar_t *wasctime_buffer; /* buffer for asctime */
int fpecode;
MSVCRT_terminate_function terminate_handler;
MSVCRT_unexpected_function unexpected_handler;
......
......@@ -487,7 +487,7 @@
@ cdecl _vsnprintf(ptr long ptr ptr) MSVCRT_vsnprintf
@ cdecl _vsnwprintf(ptr long wstr long) MSVCRT_vsnwprintf
@ cdecl _waccess(wstr long)
@ stub _wasctime #(ptr) MSVCRT__wasctime
@ cdecl _wasctime(ptr) MSVCRT__wasctime
@ cdecl _wchdir(wstr)
@ cdecl _wchmod(wstr long)
@ extern _wcmdln MSVCRT__wcmdln
......@@ -503,7 +503,7 @@
@ cdecl _wcsrev(wstr)
@ cdecl _wcsset(wstr long)
@ cdecl _wcsupr(wstr) ntdll._wcsupr
@ stub _wctime #(ptr)
@ cdecl _wctime(ptr) MSVCRT__wctime
@ extern _wenviron
@ stub _wexecl #(wstr wstr) varargs
@ stub _wexecle #(wstr wstr) varargs
......
......@@ -410,3 +410,35 @@ void MSVCRT__tzset(void)
lstrcpynA(tzname_dst, tzname[1], sizeof(tzname_dst));
tzname_dst[sizeof(tzname_dst) - 1] = '\0';
}
/*********************************************************************
* _wctime (MSVCRT.@)
*/
MSVCRT_wchar_t *MSVCRT__wasctime(const struct MSVCRT_tm *mstm) {
thread_data_t *data = msvcrt_get_thread_data();
struct tm xtm;
memset(&xtm,0,sizeof(xtm));
xtm.tm_sec = mstm->tm_sec;
xtm.tm_min = mstm->tm_min;
xtm.tm_hour = mstm->tm_hour;
xtm.tm_mday = mstm->tm_mday;
xtm.tm_mon = mstm->tm_mon;
xtm.tm_year = mstm->tm_year;
xtm.tm_wday = mstm->tm_wday;
xtm.tm_yday = mstm->tm_yday;
xtm.tm_isdst = mstm->tm_isdst;
if (!data->wasctime_buffer)
data->wasctime_buffer = MSVCRT_malloc( 30*sizeof(MSVCRT_wchar_t) ); /* ought to be enough */
MultiByteToWideChar( CP_UNIXCP, 0, asctime(&xtm), -1, data->wasctime_buffer, 30 );
return data->wasctime_buffer;
}
/*********************************************************************
* _wctime (MSVCRT.@)
*/
MSVCRT_wchar_t *MSVCRT__wctime(MSVCRT_time_t *time)
{
return MSVCRT__wasctime( MSVCRT_localtime(time) );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment