Piotr Caban : msvcrt: Reorganize _localtime64 function.
Alexandre Julliard
julliard at winehq.org
Mon Dec 10 14:00:39 CST 2012
Module: wine
Branch: master
Commit: 11216fabc488f407a4a92ed2d187c5913afe2869
URL: http://source.winehq.org/git/wine.git/?a=commit;h=11216fabc488f407a4a92ed2d187c5913afe2869
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Dec 10 12:47:54 2012 +0100
msvcrt: Reorganize _localtime64 function.
---
dlls/msvcrt/time.c | 49 +++++++++++++++++++++----------------------------
1 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index 05980a5..263c035 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -376,33 +376,6 @@ MSVCRT___time32_t CDECL MSVCRT__mkgmtime(struct MSVCRT_tm *time)
#endif
/*********************************************************************
- * _localtime64 (MSVCRT.@)
- */
-struct MSVCRT_tm* CDECL MSVCRT__localtime64(const MSVCRT___time64_t* secs)
-{
- struct tm *tm;
- thread_data_t *data;
- time_t seconds = *secs;
-
- if (seconds < 0) return NULL;
-
- _mlock(_TIME_LOCK);
- if (!(tm = localtime( &seconds))) {
- _munlock(_TIME_LOCK);
- return NULL;
- }
-
- data = msvcrt_get_thread_data();
- if(!data->time_buffer)
- data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm));
-
- unix_tm_to_msvcrt( data->time_buffer, tm );
- _munlock(_TIME_LOCK);
-
- return data->time_buffer;
-}
-
-/*********************************************************************
* _localtime64_s (MSVCRT.@)
*/
int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs)
@@ -435,11 +408,31 @@ int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs)
}
/*********************************************************************
+ * _localtime64 (MSVCRT.@)
+ */
+struct MSVCRT_tm* CDECL MSVCRT__localtime64(const MSVCRT___time64_t* secs)
+{
+ thread_data_t *data = msvcrt_get_thread_data();
+
+ if(!data->time_buffer)
+ data->time_buffer = MSVCRT_malloc(sizeof(struct MSVCRT_tm));
+
+ if(_localtime64_s(data->time_buffer, secs))
+ return NULL;
+ return data->time_buffer;
+}
+
+/*********************************************************************
* _localtime32 (MSVCRT.@)
*/
struct MSVCRT_tm* CDECL MSVCRT__localtime32(const MSVCRT___time32_t* secs)
{
- MSVCRT___time64_t secs64 = *secs;
+ MSVCRT___time64_t secs64;
+
+ if(!secs)
+ return NULL;
+
+ secs64 = *secs;
return MSVCRT__localtime64( &secs64 );
}
More information about the wine-cvs
mailing list