Changeset 8777 for trunk/src


Ignore:
Timestamp:
Jun 26, 2002, 9:42:35 AM (23 years ago)
Author:
sandervl
Message:

There are no bugs in the WGSS SystemTimeToFileTime & DosDateTimeToFileTime functions; Real problem lies in the fact that the times returned by DosFindFirst, DosFindNext, DosQueryPathInfo & DosQueryFileInfo are in local time; we must convert them to file time (UTC)

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibdos.cpp

    r8600 r8777  
    1 /* $Id: oslibdos.cpp,v 1.104 2002-06-08 11:40:15 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.105 2002-06-26 07:42:34 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    860860BOOL OSLibDosDelete(char *lpszFileName)
    861861{
    862  APIRET rc;
    863  char lOemFileName[260];
    864 
    865  CharToOemA(lpszFileName, lOemFileName);
    866 
    867   rc = DosDelete(lOemFileName);
    868   if(rc) {
    869       SetLastError(error2WinError(rc));
    870       return FALSE;
    871   }
    872   return TRUE;
     862    APIRET rc;
     863    char lOemFileName[260];
     864
     865    CharToOemA(lpszFileName, lOemFileName);
     866
     867    rc = DosDelete(lOemFileName);
     868    if(rc) {
     869        SetLastError(error2WinError(rc));
     870        return FALSE;
     871    }
     872    return TRUE;
    873873}
    874874//******************************************************************************
     
    876876BOOL pmDateTimeToFileTime(FDATE *pDate,FTIME *pTime,FILETIME *pFT)
    877877{
    878   register USHORT dosTime, dosDate;
    879 
    880   dosTime = *(USHORT*)pTime;
    881   dosDate = *(USHORT*)pDate;
    882 
    883   // PH: probably replace with faster implementation than calling Open32
    884   // through the external interface!
    885   return DosDateTimeToFileTime(dosDate,dosTime,pFT);
     878    USHORT   dosTime, dosDate;
     879    BOOL     ret;
     880    FILETIME dummy;
     881
     882    dosTime = *(USHORT*)pTime;
     883    dosDate = *(USHORT*)pDate;
     884
     885    ret = DosDateTimeToFileTime(dosDate, dosTime, &dummy);
     886    if(ret == FALSE) {
     887        return FALSE;
     888    }
     889    //time we get from OS2 is local time; win32 expects file time (UTC)
     890    ret = LocalFileTimeToFileTime(&dummy, pFT);
     891    return ret;
    886892}
    887893//******************************************************************************
  • trunk/src/kernel32/time.cpp

    r8765 r8777  
    1 /* $Id: time.cpp,v 1.20 2002-06-25 18:01:53 sandervl Exp $ */
     1/* $Id: time.cpp,v 1.21 2002-06-26 07:42:35 sandervl Exp $ */
    22
    33/*
     
    3636#define DBG_LOCALLOG    DBG_time
    3737#include "dbglocal.h"
    38 
    39 /*****************************************************************************
    40  * Defines                                                                   *
    41  *****************************************************************************/
    42 
    43 ODINDEBUGCHANNEL(KERNEL32-TIME)
    44 
    45 
    46 
    47 #define lstrcpynAtoW(unicode,ascii,asciilen) AsciiToUnicodeN(ascii,unicode,asciilen);
    48 
    49 #define WPRINTF_LEFTALIGN   0x0001  /* Align output on the left ('-' prefix) */
    50 #define WPRINTF_PREFIX_HEX  0x0002  /* Prefix hex with 0x ('#' prefix) */
    51 #define WPRINTF_ZEROPAD     0x0004  /* Pad with zeros ('0' prefix) */
    52 #define WPRINTF_LONG        0x0008  /* Long arg ('l' prefix) */
    53 #define WPRINTF_SHORT       0x0010  /* Short arg ('h' prefix) */
    54 #define WPRINTF_UPPER_HEX   0x0020  /* Upper-case hex ('X' specifier) */
    55 #define WPRINTF_WIDE        0x0040  /* Wide arg ('w' prefix) */
    56 
    57 typedef enum
    58 {
    59     WPR_UNKNOWN,
    60     WPR_CHAR,
    61     WPR_WCHAR,
    62     WPR_STRING,
    63     WPR_WSTRING,
    64     WPR_SIGNED,
    65     WPR_UNSIGNED,
    66     WPR_HEXA
    67 } WPRINTF_TYPE;
    68 
    69 typedef struct
    70 {
    71     UINT         flags;
    72     UINT         width;
    73     UINT         precision;
    74     WPRINTF_TYPE   type;
    75 } WPRINTF_FORMAT;
    76 
    77 typedef union {
    78     WCHAR   wchar_view;
    79     CHAR    char_view;
    80     LPCSTR  lpcstr_view;
    81     LPCWSTR lpcwstr_view;
    82     INT     int_view;
    83 } WPRINTF_DATA;
    84 
    85 static const CHAR null_stringA[] = "(null)";
    86 static const WCHAR null_stringW[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
    8738
    8839//******************************************************************************
     
    12980BOOL WIN32API DosDateTimeToFileTime(WORD arg1, WORD arg2, LPFILETIME arg3)
    13081{
    131     BOOL rc;
    132     rc = O32_DosDateTimeToFileTime(arg1, arg2, arg3);
    133     /* Bug in WGSS after that we must have UCT file time on return,
    134        instead we have local! */
    135     if (rc)
    136     {
    137       FILETIME dummy;
    138       /* Convert it to UCT */
    139       rc = LocalFileTimeToFileTime(arg3,&dummy);
    140       memcpy(arg3,&dummy,sizeof(FILETIME));
    141     }
    142     return rc;
     82    return O32_DosDateTimeToFileTime(arg1, arg2, arg3);
    14383}
    14484//******************************************************************************
     
    166106                                   LPFILETIME arg2)
    167107{
    168     BOOL rc;
    169     rc = O32_SystemTimeToFileTime(arg1, arg2);
    170     /* Bug in WGSS after that we must have UCT file time on return,
    171        instead we have local! */
    172     if (rc)
    173     {
    174       FILETIME dummy;
    175       /* Convert it to local */
    176       rc = LocalFileTimeToFileTime(arg2,&dummy);
    177       memcpy(arg2,&dummy,sizeof(FILETIME));
    178     }
    179     return rc;
     108    return O32_SystemTimeToFileTime(arg1, arg2);
    180109}
    181110//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.