2009-01-19 22:05:27 +00:00
|
|
|
/*
|
2009-08-06 11:01:44 +00:00
|
|
|
* COPYRIGHT: LGPL, See LGPL.txt in the top level directory
|
2009-01-19 22:05:27 +00:00
|
|
|
* PROJECT: ReactOS CRT library
|
|
|
|
* FILE: lib/sdk/crt/time/ftime.c
|
|
|
|
* PURPOSE: Deprecated BSD library call
|
|
|
|
* PROGRAMERS: Timo Kreuzer
|
|
|
|
*/
|
|
|
|
#include <precomp.h>
|
|
|
|
#include <sys/timeb.h>
|
|
|
|
#include "bitsfixup.h"
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* \name _ftime_s
|
|
|
|
* \brief Get the current time.
|
2011-09-15 17:11:53 +00:00
|
|
|
* \param [out] ptimeb Pointer to a structure of type struct _timeb that
|
2013-04-13 21:28:10 +00:00
|
|
|
* receives the current time.
|
2009-01-19 22:05:27 +00:00
|
|
|
* \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx
|
|
|
|
*/
|
|
|
|
errno_t
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
CDECL
|
2009-01-19 22:05:27 +00:00
|
|
|
_ftime_s(struct _timeb *ptimeb)
|
|
|
|
{
|
|
|
|
DWORD ret;
|
|
|
|
TIME_ZONE_INFORMATION TimeZoneInformation;
|
|
|
|
FILETIME SystemTime;
|
|
|
|
|
|
|
|
/* Validate parameters */
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
if (!MSVCRT_CHECK_PMT( ptimeb != NULL ))
|
2009-01-19 22:05:27 +00:00
|
|
|
{
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
*_errno() = EINVAL;
|
2009-01-19 22:05:27 +00:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GetTimeZoneInformation(&TimeZoneInformation);
|
|
|
|
ptimeb->dstflag = (ret == TIME_ZONE_ID_DAYLIGHT) ? 1 : 0;
|
2011-09-15 17:11:53 +00:00
|
|
|
ptimeb->timezone = (short)TimeZoneInformation.Bias;
|
2009-01-19 22:05:27 +00:00
|
|
|
|
|
|
|
GetSystemTimeAsFileTime(&SystemTime);
|
2011-09-15 17:11:53 +00:00
|
|
|
ptimeb->time = (time_t)FileTimeToUnixTime(&SystemTime, &ptimeb->millitm);
|
2009-01-19 22:05:27 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* \name _ftime
|
|
|
|
* \brief Get the current time.
|
2011-09-15 17:11:53 +00:00
|
|
|
* \param [out] ptimeb Pointer to a structure of type struct _timeb that
|
2013-04-13 21:28:10 +00:00
|
|
|
* receives the current time.
|
2011-09-15 17:11:53 +00:00
|
|
|
* \note This function is for compatability and simply calls the secure
|
2009-01-19 22:05:27 +00:00
|
|
|
* version _ftime_s().
|
|
|
|
* \sa http://msdn.microsoft.com/en-us/library/z54t9z5f.aspx
|
|
|
|
*/
|
|
|
|
void
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
CDECL
|
2009-01-19 22:05:27 +00:00
|
|
|
_ftime(struct _timeb *ptimeb)
|
|
|
|
{
|
|
|
|
_ftime_s(ptimeb);
|
|
|
|
}
|