Implement VarDateFromUdateEx.

This commit is contained in:
Jon Griffiths 2004-04-30 18:32:58 +00:00 committed by Alexandre Julliard
parent aedfc471a2
commit 89450e7cbd
2 changed files with 34 additions and 5 deletions

View File

@ -311,7 +311,7 @@
316 stdcall VarR4CmpR8(long double) 316 stdcall VarR4CmpR8(long double)
317 stdcall VarR8Round(double long ptr) 317 stdcall VarR8Round(double long ptr)
318 stdcall VarCat(ptr ptr ptr) 318 stdcall VarCat(ptr ptr ptr)
319 stub VarDateFromUdateEx # stdcall (ptr long long ptr) 319 stdcall VarDateFromUdateEx(ptr long long ptr)
320 stdcall -private DllRegisterServer() OLEAUT32_DllRegisterServer 320 stdcall -private DllRegisterServer() OLEAUT32_DllRegisterServer
321 stdcall -private DllUnregisterServer() OLEAUT32_DllUnregisterServer 321 stdcall -private DllUnregisterServer() OLEAUT32_DllUnregisterServer
322 stub GetRecordInfoFromGuids # stdcall (ptr long long long ptr ptr) 322 stub GetRecordInfoFromGuids # stdcall (ptr long long long ptr ptr)

View File

@ -1292,12 +1292,13 @@ INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt)
} }
/*********************************************************************** /***********************************************************************
* VarDateFromUdate [OLEAUT32.330] * VarDateFromUdateEx [OLEAUT32.319]
* *
* Convert an unpacked format date and time to a variant VT_DATE. * Convert an unpacked format date and time to a variant VT_DATE.
* *
* PARAMS * PARAMS
* pUdateIn [I] Unpacked format date and time to convert * pUdateIn [I] Unpacked format date and time to convert
* lcid [I] Locale identifier for the conversion
* dwFlags [I] Flags controlling the conversion (VAR_ flags from "oleauto.h") * dwFlags [I] Flags controlling the conversion (VAR_ flags from "oleauto.h")
* pDateOut [O] Destination for variant VT_DATE. * pDateOut [O] Destination for variant VT_DATE.
* *
@ -1305,17 +1306,20 @@ INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt)
* Success: S_OK. *pDateOut contains the converted value. * Success: S_OK. *pDateOut contains the converted value.
* Failure: E_INVALIDARG, if pUdateIn cannot be represented in VT_DATE format. * Failure: E_INVALIDARG, if pUdateIn cannot be represented in VT_DATE format.
*/ */
HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut) HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DATE *pDateOut)
{ {
UDATE ud; UDATE ud;
double dateVal; double dateVal;
TRACE("(%p->%d/%d/%d %d:%d:%d:%d %d %d,0x%08lx,%p)\n", pUdateIn, TRACE("(%p->%d/%d/%d %d:%d:%d:%d %d %d,0x%08lx,0x%08lx,%p)\n", pUdateIn,
pUdateIn->st.wMonth, pUdateIn->st.wDay, pUdateIn->st.wYear, pUdateIn->st.wMonth, pUdateIn->st.wDay, pUdateIn->st.wYear,
pUdateIn->st.wHour, pUdateIn->st.wMinute, pUdateIn->st.wSecond, pUdateIn->st.wHour, pUdateIn->st.wMinute, pUdateIn->st.wSecond,
pUdateIn->st.wMilliseconds, pUdateIn->st.wDayOfWeek, pUdateIn->st.wMilliseconds, pUdateIn->st.wDayOfWeek,
pUdateIn->wDayOfYear, dwFlags, pDateOut); pUdateIn->wDayOfYear, lcid, dwFlags, pDateOut);
if (lcid != MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
FIXME("lcid possibly not handled, treating as en-us\n");
memcpy(&ud, pUdateIn, sizeof(ud)); memcpy(&ud, pUdateIn, sizeof(ud));
if (dwFlags & VAR_VALIDDATE) if (dwFlags & VAR_VALIDDATE)
@ -1338,6 +1342,31 @@ HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut)
return S_OK; return S_OK;
} }
/***********************************************************************
* VarDateFromUdate [OLEAUT32.330]
*
* Convert an unpacked format date and time to a variant VT_DATE.
*
* PARAMS
* pUdateIn [I] Unpacked format date and time to convert
* dwFlags [I] Flags controlling the conversion (VAR_ flags from "oleauto.h")
* pDateOut [O] Destination for variant VT_DATE.
*
* RETURNS
* Success: S_OK. *pDateOut contains the converted value.
* Failure: E_INVALIDARG, if pUdateIn cannot be represented in VT_DATE format.
*
* NOTES
* This function uses the United States English locale for the conversion. Use
* VarDateFromUdateEx() for alternate locales.
*/
HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut)
{
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
return VarDateFromUdateEx(pUdateIn, lcid, dwFlags, pDateOut);
}
/*********************************************************************** /***********************************************************************
* VarUdateFromDate [OLEAUT32.331] * VarUdateFromDate [OLEAUT32.331]
* *