您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FileTimeToSystemTime函数代码示例

51自学网 2021-06-01 20:46:11
  C++
这篇教程C++ FileTimeToSystemTime函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FileTimeToSystemTime函数的典型用法代码示例。如果您正苦于以下问题:C++ FileTimeToSystemTime函数的具体用法?C++ FileTimeToSystemTime怎么用?C++ FileTimeToSystemTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FileTimeToSystemTime函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Get_Exception_Info

//*************************************************************LLSD WINAPI Get_Exception_Info(PEXCEPTION_POINTERS pException)//*************************************************************// Allocate Str[DUMP_SIZE_MAX] and return Str with dump, if !pException - just return call stack in Str.{	LLSD info;	LPWSTR		Str;	int			Str_Len;//	int			i;	LPWSTR		Module_Name = new WCHAR[MAX_PATH];	PBYTE		Module_Addr;	HANDLE		hFile;	FILETIME	Last_Write_Time;	FILETIME	Local_File_Time;	SYSTEMTIME	T;	Str = new WCHAR[DUMP_SIZE_MAX];	Str_Len = 0;	if (!Str)		return NULL;		Get_Version_Str(info);		GetModuleFileName(NULL, Str, MAX_PATH);	info["Process"] = ll_convert_wide_to_string(Str);	info["ThreadID"] = (S32)GetCurrentThreadId();	// If exception occurred.	if (pException)	{		EXCEPTION_RECORD &	E = *pException->ExceptionRecord;		CONTEXT &			C = *pException->ContextRecord;		// If module with E.ExceptionAddress found - save its path and date.		if (Get_Module_By_Ret_Addr((PBYTE)E.ExceptionAddress, Module_Name, Module_Addr))		{			info["Module"] = ll_convert_wide_to_string(Module_Name);			if ((hFile = CreateFile(Module_Name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,				FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE)			{				if (GetFileTime(hFile, NULL, NULL, &Last_Write_Time))				{					FileTimeToLocalFileTime(&Last_Write_Time, &Local_File_Time);					FileTimeToSystemTime(&Local_File_Time, &T);					info["DateModified"] = llformat("%02d/%02d/%d", T.wMonth, T.wDay, T.wYear);				}				CloseHandle(hFile);			}		}		else		{			info["ExceptionAddr"] = (int)E.ExceptionAddress;		}				info["ExceptionCode"] = (int)E.ExceptionCode;				/*		//TODO: Fix this		if (E.ExceptionCode == EXCEPTION_ACCESS_VIOLATION)		{			// Access violation type - Write/Read.			LLSD exception_info;			exception_info["Type"] = E.ExceptionInformation[0] ? "Write" : "Read";			exception_info["Address"] = llformat("%08x", E.ExceptionInformation[1]);			info["Exception Information"] = exception_info;		}		*/				// Save instruction that caused exception.		/*		std::string str;		for (i = 0; i < 16; i++)			str += llformat(" %02X", PBYTE(E.ExceptionAddress)[i]);		info["Instruction"] = str;		*/		LLSD registers;		registers["EAX"] = (int)C.Eax;		registers["EBX"] = (int)C.Ebx;		registers["ECX"] = (int)C.Ecx;		registers["EDX"] = (int)C.Edx;		registers["ESI"] = (int)C.Esi;		registers["EDI"] = (int)C.Edi;		registers["ESP"] = (int)C.Esp;		registers["EBP"] = (int)C.Ebp;		registers["EIP"] = (int)C.Eip;		registers["EFlags"] = (int)C.EFlags;		info["Registers"] = registers;	} //if (pException)		// Save call stack info.	Get_Call_Stack(pException->ExceptionRecord, pException->ContextRecord, info);	return info;} //Get_Exception_Info
开发者ID:Boy,项目名称:rainbow,代码行数:97,


示例2: HeapAlloc

//.........这里部分代码省略.........     BOOL addNewLine = TRUE;     for (cols=0; cols<numCols; cols++) {      WCHAR username[24];      /* Work out the index of the entry being pointed to */      if (orderByCol) {        i = (cols * numRows) + rows;        if (i >= entry_count) continue;      } else {        i = (rows * numCols) + cols;        if (i >= entry_count) continue;      }      /* /L convers all names to lower case */      if (lower) {          WCHAR *p = (fd+i)->cFileName;          while ( (*p = tolower(*p)) ) ++p;      }      /* /Q gets file ownership information */      if (usernames) {          strcpyW (string, inputparms->dirName);          strcatW (string, (fd+i)->cFileName);          WCMD_getfileowner(string, username, sizeof(username)/sizeof(WCHAR));      }      if (dirTime == Written) {        FileTimeToLocalFileTime (&(fd+i)->ftLastWriteTime, &ft);      } else if (dirTime == Access) {        FileTimeToLocalFileTime (&(fd+i)->ftLastAccessTime, &ft);      } else {        FileTimeToLocalFileTime (&(fd+i)->ftCreationTime, &ft);      }      FileTimeToSystemTime (&ft, &st);      GetDateFormatW(0, DATE_SHORTDATE, &st, NULL, datestring,			sizeof(datestring)/sizeof(WCHAR));      GetTimeFormatW(0, TIME_NOSECONDS, &st,			NULL, timestring, sizeof(timestring)/sizeof(WCHAR));      if (wide) {        tmp_width = cur_width;        if ((fd+i)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {            static const WCHAR fmt[] = {'[','%','s',']','/0'};            WCMD_output (fmt, (fd+i)->cFileName);            dir_count++;            tmp_width = tmp_width + strlenW((fd+i)->cFileName) + 2;        } else {            static const WCHAR fmt[] = {'%','s','/0'};            WCMD_output (fmt, (fd+i)->cFileName);            tmp_width = tmp_width + strlenW((fd+i)->cFileName) ;            file_count++;            file_size.u.LowPart = (fd+i)->nFileSizeLow;            file_size.u.HighPart = (fd+i)->nFileSizeHigh;        byte_count.QuadPart += file_size.QuadPart;        }        cur_width = cur_width + widest;        if ((cur_width + widest) > max_width) {            cur_width = 0;        } else {            int padding = cur_width - tmp_width;            int toWrite = 0;            WCHAR temp[101];            /* Note: WCMD_output uses wvsprintf which does not allow %*
开发者ID:aragaer,项目名称:wine,代码行数:67,


示例3: DeviceAtaHealthInfo

//.........这里部分代码省略.........            if ((generalLog->PoweronHours.Supported == 1) && (generalLog->PoweronHours.ValidValue == 1)) {                _tprintf(_T("/t Power-on Hours: %I64d/n"), generalLog->PoweronHours.Count);            }            if ((generalLog->LogicalSectorsWritten.Supported == 1) && (generalLog->LogicalSectorsWritten.ValidValue == 1)) {                _tprintf(_T("/t Logical Sectors Written: %I64d/n"), generalLog->LogicalSectorsWritten.Count);            }            if ((generalLog->WriteCommandCount.Supported == 1) && (generalLog->WriteCommandCount.ValidValue == 1)) {                _tprintf(_T("/t Write Command Count: %I64d/n"), generalLog->WriteCommandCount.Count);            }            if ((generalLog->LogicalSectorsRead.Supported == 1) && (generalLog->LogicalSectorsRead.ValidValue == 1)) {                _tprintf(_T("/t Logical Sectors Read: %I64d/n"), generalLog->LogicalSectorsRead.Count);            }            if ((generalLog->ReadCommandCount.Supported == 1) && (generalLog->ReadCommandCount.ValidValue == 1)) {                _tprintf(_T("/t Read Command Count: %I64d/n"), generalLog->ReadCommandCount.Count);            }            if ((generalLog->DateAndTime.Supported == 1) && (generalLog->DateAndTime.ValidValue == 1)) {                // convert the value to system time                SYSTEMTIME systemTime = {0};                TCHAR localDate[255] = {0};                TCHAR localTime[255] = {0};                ULONGLONG time = generalLog->DateAndTime.TimeStamp + 0xA9741731300;                time *= 10000;                FileTimeToLocalFileTime((LPFILETIME)&time, (LPFILETIME)&time);                FileTimeToSystemTime((LPFILETIME)&time, &systemTime);                GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systemTime, NULL, localDate, 255);                GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systemTime, NULL, localTime, 255);                _tprintf(_T("/t Time Stamp: %s %s/n"), localDate, localTime);            }            if ((generalLog->PendingErrorCount.Supported == 1) && (generalLog->PendingErrorCount.ValidValue == 1)) {                _tprintf(_T("/t Pending Error Sectors Count: %I64d/n"), generalLog->PendingErrorCount.Count);            }            if ((generalLog->WorkloadUtilizaton.Supported == 1) && (generalLog->WorkloadUtilizaton.ValidValue == 1)) {                _tprintf(_T("/t Workload Utilization Percentage: %I64d/n"), generalLog->WorkloadUtilizaton.Value);            }            if ((generalLog->UtilizationUsageRate.Supported == 1) && (generalLog->UtilizationUsageRate.ValidValue == 1)) {                if (generalLog->UtilizationUsageRate.RateValidity == 0x00) {                    //valid                    _tprintf(_T("/t Utilization Usage Rate Percentagge: %I64d"), generalLog->UtilizationUsageRate.Value);                    if (generalLog->UtilizationUsageRate.RateBasis == 0x0) {                        _tprintf(_T(" (Based on the time of manufacture until the time indicated by the Date and Time TimeStamp device statistic, including times during which the device was powered off.) /n"));                    } else if (generalLog->UtilizationUsageRate.RateBasis == 0x4) {                        _tprintf(_T(" (Based on the time elapsed since the most recent processing of a power-on reset.) /n"));                    } else if (generalLog->UtilizationUsageRate.RateBasis == 0x8) {                        _tprintf(_T(" (Based on the Power-on Hours device statistic.) /n"));                    } else if (generalLog->UtilizationUsageRate.RateBasis == 0xF) {                        _tprintf(_T(" (Basis is undetermined.) /n"));                    } else {                        _tprintf(_T(" (Basis is not a valid value.) /n"));                    }
开发者ID:Microsoft,项目名称:StorScore,代码行数:67,


示例4: XCOPY_ParseCommandLine

//.........这里部分代码省略.........            case 'Y': flags |= OPT_NOPROMPT;      break;            case 'N': flags |= OPT_SHORTNAME;     break;            case 'U': flags |= OPT_MUSTEXIST;     break;            case 'R': flags |= OPT_REPLACEREAD;   break;            case 'H': flags |= OPT_COPYHIDSYS;    break;            case 'C': flags |= OPT_IGNOREERRORS;  break;            case 'P': flags |= OPT_SRCPROMPT;     break;            case 'A': flags |= OPT_ARCHIVEONLY;   break;            case 'M': flags |= OPT_ARCHIVEONLY |                               OPT_REMOVEARCH;    break;            /* E can be /E or /EXCLUDE */            case 'E': if (CompareStringW(LOCALE_USER_DEFAULT,                                         NORM_IGNORECASE | SORT_STRINGSORT,                                         &word[1], 8,                                         EXCLUDE, -1) == CSTR_EQUAL) {                        if (XCOPY_ProcessExcludeList(&word[9])) {                          XCOPY_FailMessage(ERROR_INVALID_PARAMETER);                          goto out;                        } else flags |= OPT_EXCLUDELIST;                      } else flags |= OPT_EMPTYDIR | OPT_RECURSIVE;                      break;            /* D can be /D or /D: */            case 'D': if (word[2]==':' && isdigit(word[3])) {                          SYSTEMTIME st;                          WCHAR     *pos = &word[3];                          BOOL       isError = FALSE;                          memset(&st, 0x00, sizeof(st));                          /* Microsoft xcopy's usage message implies that the date                           * format depends on the locale, but that is false.                           * It is hardcoded to month-day-year.                           */                          st.wMonth = _wtol(pos);                          while (*pos && isdigit(*pos)) pos++;                          if (*pos++ != '-') isError = TRUE;                          if (!isError) {                              st.wDay = _wtol(pos);                              while (*pos && isdigit(*pos)) pos++;                              if (*pos++ != '-') isError = TRUE;                          }                          if (!isError) {                              st.wYear = _wtol(pos);                              while (*pos && isdigit(*pos)) pos++;                              if (st.wYear < 100) st.wYear+=2000;                          }                          if (!isError && SystemTimeToFileTime(&st, &dateRange)) {                              SYSTEMTIME st;                              WCHAR datestring[32], timestring[32];                              flags |= OPT_DATERANGE;                              /* Debug info: */                              FileTimeToSystemTime (&dateRange, &st);                              GetDateFormatW(0, DATE_SHORTDATE, &st, NULL, datestring,                                             sizeof(datestring)/sizeof(WCHAR));                              GetTimeFormatW(0, TIME_NOSECONDS, &st,                                             NULL, timestring, sizeof(timestring)/sizeof(WCHAR));                              WINE_TRACE("Date being used is: %s %s/n",                                         wine_dbgstr_w(datestring), wine_dbgstr_w(timestring));                          } else {                              XCOPY_FailMessage(ERROR_INVALID_PARAMETER);                              goto out;                          }                      } else {                          flags |= OPT_DATENEWER;                      }                      break;            case '-': if (toupper(word[2])=='Y')                          flags &= ~OPT_NOPROMPT;                      break;            case '?': XCOPY_wprintf(XCOPY_LoadMessage(STRING_HELP));                      rc = RC_HELP;                      goto out;            default:                WINE_TRACE("Unhandled parameter '%s'/n", wine_dbgstr_w(word));                XCOPY_wprintf(XCOPY_LoadMessage(STRING_INVPARM), word);                goto out;            }        }        word = next;    }    /* Default the destination if not supplied */    if (supplieddestination[0] == 0x00)        lstrcpyW(supplieddestination, wchr_dot);    *pflags = flags;    rc = RC_OK; out:    free(cmdline);    return rc;}
开发者ID:RPG-7,项目名称:reactos,代码行数:101,


示例5: switch

//.........这里部分代码省略.........                break;            case _PIMPR_COMPANY_TELEPHONE_NUMBER:				contact->CONTACT_PIMPR_COMPANY_TELEPHONE_NUMBER=ptrPS->val.lpwstr;                break;            case _PIMPR_SPOUSE:				contact->CONTACT_PIMPR_SPOUSE=ptrPS->val.lpwstr;                break;            case _PIMPR_BUSINESS_ADDRESS_STREET:				contact->CONTACT_PIMPR_BUSINESS_ADDRESS_STREET=ptrPS->val.lpwstr;                break;            case _PIMPR_BUSINESS_ADDRESS_CITY:				contact->CONTACT_PIMPR_BUSINESS_ADDRESS_CITY=ptrPS->val.lpwstr;                break;            case _PIMPR_CHILDREN:				contact->CONTACT_PIMPR_CHILDREN=ptrPS->val.lpwstr;                break;            case _PIMPR_WEB_PAGE:				contact->CONTACT_PIMPR_WEB_PAGE=ptrPS->val.lpwstr;                break;            case _PIMPR_BUSINESS_ADDRESS_STATE:				contact->CONTACT_PIMPR_BUSINESS_ADDRESS_STATE=ptrPS->val.lpwstr;                break;            case _PIMPR_BUSINESS_ADDRESS_POSTAL_CODE:				contact->CONTACT_PIMPR_BUSINESS_ADDRESS_POSTAL_CODE=ptrPS->val.lpwstr;                break;            case _PIMPR_BUSINESS_ADDRESS_COUNTRY:				contact->CONTACT_PIMPR_BUSINESS_ADDRESS_COUNTRY=ptrPS->val.lpwstr;                break;            case _PIMPR_HOME_ADDRESS_STREET:				contact->CONTACT_PIMPR_HOME_ADDRESS_STREET=ptrPS->val.lpwstr;                break;            case _PIMPR_HOME_ADDRESS_CITY:				contact->CONTACT_PIMPR_HOME_ADDRESS_CITY=ptrPS->val.lpwstr;                break;            case _PIMPR_HOME_ADDRESS_COUNTRY:				contact->CONTACT_PIMPR_HOME_ADDRESS_COUNTRY=ptrPS->val.lpwstr;                break;            case _PIMPR_OTHER_ADDRESS_STREET:				contact->CONTACT_PIMPR_OTHER_ADDRESS_STREET=ptrPS->val.lpwstr;                break;            case _PIMPR_OTHER_ADDRESS_CITY:				contact->CONTACT_PIMPR_OTHER_ADDRESS_CITY=ptrPS->val.lpwstr;                break;            case _PIMPR_HOME_ADDRESS_STATE:				contact->CONTACT_PIMPR_HOME_ADDRESS_STATE=ptrPS->val.lpwstr;                break;            case _PIMPR_HOME_ADDRESS_POSTAL_CODE:				contact->CONTACT_PIMPR_HOME_ADDRESS_POSTAL_CODE=ptrPS->val.lpwstr;                break;            case _PIMPR_OTHER_ADDRESS_STATE:				contact->CONTACT_PIMPR_OTHER_ADDRESS_STATE=ptrPS->val.lpwstr;                break;            case _PIMPR_OTHER_ADDRESS_POSTAL_CODE:				contact->CONTACT_PIMPR_OTHER_ADDRESS_POSTAL_CODE=ptrPS->val.lpwstr;                break;            case _PIMPR_OTHER_ADDRESS_COUNTRY:				contact->CONTACT_PIMPR_OTHER_ADDRESS_COUNTRY=ptrPS->val.lpwstr;                break;            case _PIMPR_FLOATING_BIRTHDAY:            {				FILETIME fileTime = {ptrPS->val.filetime.dwLowDateTime, ptrPS->val.filetime.dwHighDateTime};                SYSTEMTIME lpUniversalTime,lpLocalTime;                FileTimeToSystemTime(&fileTime, &lpUniversalTime);				_SystemTimeToTzSpecificLocalTime(NULL,&lpUniversalTime ,&lpLocalTime);								WCHAR msg[32];				swprintf_s(msg, L"%02i/%02i/%04i",lpLocalTime.wDay,lpLocalTime.wMonth,lpLocalTime.wYear);				wcscpy((wchar_t*)contact->CONTACT_PIMPR_FLOATING_BIRTHDAY,msg);                break;            }            case _PIMPR_BODY_TEXT:				contact->CONTACT_PIMPR_BODY_TEXT=ptrPS->val.lpwstr;                break;        }	}  }
开发者ID:BwRy,项目名称:core-winphone,代码行数:101,


示例6: TIME_CompTimeZoneID

/*********************************************************************** *  TIME_CompTimeZoneID * *  Computes the local time bias for a given time and time zone. * *  PARAMS *      pTZinfo     [in] The time zone data. *      lpFileTime  [in] The system or local time. *      islocal     [in] it is local time. * *  RETURNS *      TIME_ZONE_ID_INVALID    An error occurred *      TIME_ZONE_ID_UNKNOWN    There are no transition time known *      TIME_ZONE_ID_STANDARD   Current time is standard time *      TIME_ZONE_ID_DAYLIGHT   Current time is daylight savings time */static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,                                   FILETIME *lpFileTime, BOOL islocal ){    int ret, year;    BOOL beforeStandardDate, afterDaylightDate;    DWORD retval = TIME_ZONE_ID_INVALID;    LONGLONG llTime = 0; /* initialized to prevent gcc complaining */    SYSTEMTIME SysTime;    FILETIME ftTemp;    if (pTZinfo->DaylightDate.wMonth != 0)    {        /* if year is 0 then date is in day-of-week format, otherwise         * it's absolute date.         */        if (pTZinfo->StandardDate.wMonth == 0 ||                (pTZinfo->StandardDate.wYear == 0 &&                 (pTZinfo->StandardDate.wDay<1 ||                  pTZinfo->StandardDate.wDay>5 ||                  pTZinfo->DaylightDate.wDay<1 ||                  pTZinfo->DaylightDate.wDay>5)))        {            SetLastError(ERROR_INVALID_PARAMETER);            return TIME_ZONE_ID_INVALID;        }        if (!islocal) {            FILETIME2LL( lpFileTime, llTime );            llTime -= pTZinfo->Bias * (LONGLONG)600000000;            LL2FILETIME( llTime, &ftTemp)            lpFileTime = &ftTemp;        }        FileTimeToSystemTime(lpFileTime, &SysTime);        year = SysTime.wYear;        if (!islocal) {            llTime -= pTZinfo->DaylightBias * (LONGLONG)600000000;            LL2FILETIME( llTime, &ftTemp)            FileTimeToSystemTime(lpFileTime, &SysTime);        }        /* check for daylight savings */        if(year == SysTime.wYear) {            ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate);            if (ret == -2)                return TIME_ZONE_ID_INVALID;            beforeStandardDate = ret < 0;        } else            beforeStandardDate = SysTime.wYear < year;        if (!islocal) {            llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias )                      * (LONGLONG)600000000;            LL2FILETIME( llTime, &ftTemp)            FileTimeToSystemTime(lpFileTime, &SysTime);        }        if(year == SysTime.wYear) {            ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate);            if (ret == -2)                return TIME_ZONE_ID_INVALID;            afterDaylightDate = ret >= 0;        } else            afterDaylightDate = SysTime.wYear > year;        retval = TIME_ZONE_ID_STANDARD;        if( pTZinfo->DaylightDate.wMonth <  pTZinfo->StandardDate.wMonth ) {            /* Northern hemisphere */            if( beforeStandardDate && afterDaylightDate )                retval = TIME_ZONE_ID_DAYLIGHT;        } else    /* Down south */            if( beforeStandardDate || afterDaylightDate )                retval = TIME_ZONE_ID_DAYLIGHT;    } else        /* No transition date */        retval = TIME_ZONE_ID_UNKNOWN;    return retval;}
开发者ID:pombredanne,项目名称:wine,代码行数:98,


示例7: APR_DECLARE

APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,                                          apr_time_t input){    SYSTEMTIME st;    FILETIME ft, localft;    AprTimeToFileTime(&ft, input);#if APR_HAS_UNICODE_FS && !defined(_WIN32_WCE)    IF_WIN_OS_IS_UNICODE    {        TIME_ZONE_INFORMATION *tz;        SYSTEMTIME localst;        apr_time_t localtime;        get_local_timezone(&tz);        FileTimeToSystemTime(&ft, &st);        /* The Platform SDK documents that SYSTEMTIME/FILETIME are         * generally UTC.  We use SystemTimeToTzSpecificLocalTime         * because FileTimeToLocalFileFime is documented that the         * resulting time local file time would have DST relative         * to the *present* date, not the date converted.         */        SystemTimeToTzSpecificLocalTime(tz, &st, &localst);        SystemTimeToAprExpTime(result, &localst);        result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);        /* Recover the resulting time as an apr time and use the         * delta for gmtoff in seconds (and ignore msec rounding)          */        SystemTimeToFileTime(&localst, &localft);        FileTimeToAprTime(&localtime, &localft);        result->tm_gmtoff = (int)apr_time_sec(localtime)                           - (int)apr_time_sec(input);        /* To compute the dst flag, we compare the expected          * local (standard) timezone bias to the delta.         * [Note, in war time or double daylight time the         * resulting tm_isdst is, desireably, 2 hours]         */        result->tm_isdst = (result->tm_gmtoff / 3600)                         - (-(tz->Bias + tz->StandardBias) / 60);    }#endif#if APR_HAS_ANSI_FS || defined(_WIN32_WCE)    ELSE_WIN_OS_IS_ANSI    {        TIME_ZONE_INFORMATION tz;	/* XXX: This code is simply *wrong*.  The time converted will always         * map to the *now current* status of daylight savings time.         */        FileTimeToLocalFileTime(&ft, &localft);        FileTimeToSystemTime(&localft, &st);        SystemTimeToAprExpTime(result, &st);        result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);        switch (GetTimeZoneInformation(&tz)) {            case TIME_ZONE_ID_UNKNOWN:                result->tm_isdst = 0;                /* Bias = UTC - local time in minutes                 * tm_gmtoff is seconds east of UTC                 */                result->tm_gmtoff = tz.Bias * -60;                break;            case TIME_ZONE_ID_STANDARD:                result->tm_isdst = 0;                result->tm_gmtoff = (tz.Bias + tz.StandardBias) * -60;                break;            case TIME_ZONE_ID_DAYLIGHT:                result->tm_isdst = 1;                result->tm_gmtoff = (tz.Bias + tz.DaylightBias) * -60;                break;            default:                /* noop */;        }    }#endif    return APR_SUCCESS;}
开发者ID:AAthresh,项目名称:quantlib,代码行数:84,


示例8: GetWin32

void RarTime::GetLocal(RarLocalTime *lt){#ifdef _WIN_ALL  FILETIME ft;  GetWin32(&ft);  FILETIME lft;  if (WinNT() < WNT_VISTA)  {    // SystemTimeToTzSpecificLocalTime based code produces 1 hour error on XP.    FileTimeToLocalFileTime(&ft,&lft);  }  else  {    // We use these functions instead of FileTimeToLocalFileTime according to    // MSDN recommendation: "To account for daylight saving time    // when converting a file time to a local time ..."    SYSTEMTIME st1,st2;    FileTimeToSystemTime(&ft,&st1);    SystemTimeToTzSpecificLocalTime(NULL,&st1,&st2);    SystemTimeToFileTime(&st2,&lft);    // Correct precision loss (low 4 decimal digits) in FileTimeToSystemTime.    FILETIME rft;    SystemTimeToFileTime(&st1,&rft);    int64 Corrected=INT32TO64(ft.dwHighDateTime,ft.dwLowDateTime)-                    INT32TO64(rft.dwHighDateTime,rft.dwLowDateTime)+                    INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime);    lft.dwLowDateTime=(DWORD)Corrected;    lft.dwHighDateTime=(DWORD)(Corrected>>32);  }  SYSTEMTIME st;  FileTimeToSystemTime(&lft,&st);  lt->Year=st.wYear;  lt->Month=st.wMonth;  lt->Day=st.wDay;  lt->Hour=st.wHour;  lt->Minute=st.wMinute;  lt->Second=st.wSecond;  lt->wDay=st.wDayOfWeek;  lt->yDay=lt->Day-1;  static int mdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};  for (uint I=1;I<lt->Month && I<=ASIZE(mdays);I++)    lt->yDay+=mdays[I-1];  if (lt->Month>2 && IsLeapYear(lt->Year))    lt->yDay++;  st.wMilliseconds=0;  FILETIME zft;  SystemTimeToFileTime(&st,&zft);  // Calculate the time reminder, which is the part of time smaller  // than 1 second, represented in 100-nanosecond intervals.  lt->Reminder=INT32TO64(lft.dwHighDateTime,lft.dwLowDateTime)-               INT32TO64(zft.dwHighDateTime,zft.dwLowDateTime);#else  time_t ut=GetUnix();  struct tm *t;  t=localtime(&ut);  lt->Year=t->tm_year+1900;  lt->Month=t->tm_mon+1;  lt->Day=t->tm_mday;  lt->Hour=t->tm_hour;  lt->Minute=t->tm_min;  lt->Second=t->tm_sec;  lt->Reminder=itime % 10000000;  lt->wDay=t->tm_wday;  lt->yDay=t->tm_yday;#endif}
开发者ID:Cpasjuste,项目名称:nzbm,代码行数:74,


示例9: _T

// This method compresses the files contained in the report and produces a ZIP archive.BOOL CErrorReportExporter::CompressReportFiles(CErrorReportInfo* eri){ 	BOOL bStatus = FALSE;	strconv_t strconv;	zipFile hZip = NULL;	CString sMsg;	LONG64 lTotalSize = 0;	LONG64 lTotalCompressed = 0;	BYTE buff[1024];	DWORD dwBytesRead=0;	HANDLE hFile = INVALID_HANDLE_VALUE;  	std::map<CString, ERIFileItem>::iterator it;	FILE* f = NULL;	CString sMD5Hash;	// Add a different log message depending on the current mode.	if(m_bExport)		m_Assync.SetProgress(_T("[exporting_report]"), 0, false);	else		m_Assync.SetProgress(_T("[compressing_files]"), 0, false);	// Calculate the total size of error report files	lTotalSize = eri->GetTotalSize();	// Add a message to log	sMsg.Format(_T("Total file size for compression is %I64d bytes"), lTotalSize);	m_Assync.SetProgress(sMsg, 0, false);	// Determine what name to use for the output ZIP archive file.	if(m_bExport)		m_sZipName = m_sExportFileName;  	else		m_sZipName = eri->GetErrorReportDirName() + _T(".zip");  	// Update progress	sMsg.Format(_T("Creating ZIP archive file %s"), m_sZipName);	m_Assync.SetProgress(sMsg, 1, false);	// Create ZIP archive	hZip = zipOpen((const char*)m_sZipName.GetBuffer(0), APPEND_STATUS_CREATE);	if(hZip==NULL)	{		m_Assync.SetProgress(_T("Failed to create ZIP file."), 100, true);		goto cleanup;	}	// Enumerate files contained in the report	int i;	for(i=0; i<eri->GetFileItemCount(); i++)	{ 		ERIFileItem* pfi = eri->GetFileItemByIndex(i);		// Check if the operation was cancelled by user		if(m_Assync.IsCancelled())    			goto cleanup;		// Define destination file name in ZIP archive		CString sDstFileName = pfi->m_sDestFile.GetBuffer(0);		// Define source file name		CString sFileName = pfi->m_sSrcFile.GetBuffer(0);		// Define file description		CString sDesc = pfi->m_sDesc;		// Update progress		sMsg.Format(_T("Compressing file %s"), sDstFileName);		m_Assync.SetProgress(sMsg, 0, false);		// Open file for reading		hFile = CreateFile(sFileName, 			GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); 		if(hFile==INVALID_HANDLE_VALUE)		{			sMsg.Format(_T("Couldn't open file %s"), sFileName);			m_Assync.SetProgress(sMsg, 0, false);			continue;		}		// Get file information.		BY_HANDLE_FILE_INFORMATION fi;		GetFileInformationByHandle(hFile, &fi);		// Convert file creation time to system file time.		SYSTEMTIME st;		FileTimeToSystemTime(&fi.ftLastWriteTime, &st);		// Fill in the ZIP file info		zip_fileinfo info;		info.dosDate = 0;		info.tmz_date.tm_year = st.wYear;		info.tmz_date.tm_mon = st.wMonth-1;		info.tmz_date.tm_mday = st.wDay;		info.tmz_date.tm_hour = st.wHour;		info.tmz_date.tm_min = st.wMinute;		info.tmz_date.tm_sec = st.wSecond;		info.external_fa = FILE_ATTRIBUTE_NORMAL;		info.internal_fa = FILE_ATTRIBUTE_NORMAL;		// Create new file inside of our ZIP archive		int n = zipOpenNewFileInZip( hZip, (const char*)strconv.t2a(sDstFileName.GetBuffer(0)), &info,//.........这里部分代码省略.........
开发者ID:geemion,项目名称:crash-exporter,代码行数:101,


示例10: FileTimeToStr

void FileTimeToStr (FILETIME *time, LPSTR pszDate, LPSTR pszTime, BOOL bSeconds){	SYSTEMTIME s;	FileTimeToSystemTime (time, &s);	SystemTimeToStr (&s, pszDate, pszTime, bSeconds);}
开发者ID:ratever930,项目名称:freedownload,代码行数:6,


示例11: token

//.........这里部分代码省略.........    // Copy the application's File Version String    strcpyW (lpw, wszFileVer);    // Skip to the trailing zero    lpw += lstrlenW (lpw);    *lpw++ = L' ';      // Blank separators    *lpw++ = L' ';    // Open the executable file so we get its last write time    hFile =      CreateFileW (wszAppDPFE,              // lpwFileName                   GENERIC_READ,            // dwDesiredAccess                   FILE_SHARE_READ,         // dwShareMode                   NULL,                    // lpSecurityAttributes                   OPEN_EXISTING,           // dwCreationDistribution                   FILE_ATTRIBUTE_NORMAL,   // dwFlagsAndAttributes                   NULL);                   // hTemplateFile    if (hFile NE INVALID_HANDLE_VALUE)    {        FILETIME   ftLastWrite;        SYSTEMTIME systemTime;        // Get the file's last write time        // Note that the file's creation time need not be the        //   same as the file's last write time.  I think the        //   linker might sometimes rewrite the .exe file        //   instead of recreating it.        GetFileTime (hFile, NULL, NULL, &ftLastWrite);        // We no longer need this handle        CloseHandle (hFile); hFile = NULL;        // Convert the file's last write time to system time        FileTimeToSystemTime (&ftLastWrite, &systemTime);        // Format the system time as        //    "Wed Jan 02 02:03:55 1980"        wsprintfW (lpw,                   L"%s %s %02u %02u:%02u:%02u %u",                   aDaysOfWeek[systemTime.wDayOfWeek],                   aMonths[systemTime.wMonth - 1],                   systemTime.wDay,                   systemTime.wHour,                   systemTime.wMinute,                   systemTime.wSecond,                   systemTime.wYear);        // Skip to the trailing zero        lpw += lstrlenW (lpw);        *lpw++ = L' ';    // Blank separators        *lpw++ = L' ';    } // End IF#ifdef _WIN64  #define SYSTYPE     L"Win/64" DEBUGSTR#elif defined (_WIN32)  #define SYSTYPE     L"Win/32" DEBUGSTR#else  #error Need code for this architecture.#endif    // Copy to the result    CopyMemoryW (lpw, SYSTYPE, strcountof (SYSTYPE));    // Calculate the actual NELM    aplNELMRes = lstrlenW (lpMemData);
开发者ID:PlanetAPL,项目名称:nars2000,代码行数:66,


示例12: DlgProcAlarm

//.........这里部分代码省略.........							}						}					}				}			}		}		return TRUE;	case WM_MOVE:		Utils_SaveWindowPosition(hwndDlg, 0, MODULE, "Notify");		break;	case WMU_ADDSNOOZER:		{			WindowData *wd = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);			if (wd) {				ALARM *data = wd->alarm;				if (data) {					// add snooze minutes to current time					FILETIME ft;					GetLocalTime(&data->time);					SystemTimeToFileTime(&data->time, &ft);					ULARGE_INTEGER uli;					uli.LowPart = ft.dwLowDateTime;					uli.HighPart = ft.dwHighDateTime;					// there are 10000000 100-nanosecond blocks in a second...					uli.QuadPart += mult.QuadPart * (int)(wParam);					ft.dwHighDateTime = uli.HighPart;					ft.dwLowDateTime = uli.LowPart;					FileTimeToSystemTime(&ft, &data->time);					data->occurrence = OC_ONCE;					data->snoozer = true;					data->flags = data->flags & ~ALF_NOSTARTUP;					data->id = next_alarm_id++;					append_to_list(data);				}			}		}		return TRUE;	case WM_COMMAND:		if ( HIWORD( wParam ) == BN_CLICKED ) {			switch( LOWORD( wParam )) {			case IDCANCEL:  // no button - esc pressed			case IDOK:		// space?			case IDC_SNOOZE:				SendMessage(hwndDlg, WMU_ADDSNOOZER, (WPARAM)options.snooze_minutes, 0);				//drop through			case IDC_DISMISS:				{					WindowData *window_data = (WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);					KillTimer(hwndDlg, ID_TIMER_SOUND);					if (window_data) {						if (window_data->alarm) {							free_alarm_data(window_data->alarm);							delete window_data->alarm;						}						delete window_data;					}
开发者ID:chinadayang,项目名称:miranda-ng,代码行数:67,


示例13: hb_fsFindNextLow

//.........这里部分代码省略.........         }         /* Fill Harbour found file info */         if( bFound )         {            HB_OSSTRDUP2( info->pFindFileData.cFileName, ffind->szName, sizeof( ffind->szName ) - 1 );            if( info->pFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )               ffind->size = 0;            else            {#if defined( __XCC__ ) || ( defined( __POCC__ ) && __POCC__ >= 500 )               /* NOTE: PellesC 5.00.1 will go into an infinite loop if we don't                        split this into two operations. [vszakats] */               ffind->size  = ( HB_FOFFSET ) info->pFindFileData.nFileSizeLow;               ffind->size += ( HB_FOFFSET ) info->pFindFileData.nFileSizeHigh << 32;#else               ffind->size = ( HB_FOFFSET ) info->pFindFileData.nFileSizeLow +                           ( ( HB_FOFFSET ) info->pFindFileData.nFileSizeHigh << 32 );#endif            }            raw_attr = ( HB_FATTR ) info->pFindFileData.dwFileAttributes;            /* NOTE: One of these may fail when searching on an UNC path, I                     don't know yet what's the reason. [vszakats] */            {               FILETIME ft;               SYSTEMTIME time;               if( FileTimeToLocalFileTime( &info->pFindFileData.ftLastWriteTime, &ft ) &&                   FileTimeToSystemTime( &ft, &time ) )               {                  iYear  = time.wYear;                  iMonth = time.wMonth;                  iDay   = time.wDay;                  iHour  = time.wHour;                  iMin   = time.wMinute;                  iSec   = time.wSecond;                  iMSec  = time.wMilliseconds;               }            }         }      }      hb_fsSetIOError( bFound, 0 );   }#elif defined( HB_OS_UNIX )   {      PHB_FFIND_INFO info = ( PHB_FFIND_INFO ) ffind->info;      char dirname[ HB_PATH_MAX ];      bFound = HB_FALSE;      /* TODO: HB_FA_LABEL handling */      if( ffind->bFirst )      {         char * pos;         ffind->bFirst = HB_FALSE;
开发者ID:jiangxilong,项目名称:core,代码行数:66,


示例14: CreateFile

// This method compresses the files contained in the report and produces ZIP archive.BOOL CErrorReportSender::CompressReportFiles(){   BOOL bStatus = FALSE;  strconv_t strconv;  zipFile hZip = NULL;  CString sMsg;  LONG64 lTotalSize = 0;  LONG64 lTotalCompressed = 0;  BYTE buff[1024];  DWORD dwBytesRead=0;  HANDLE hFile = INVALID_HANDLE_VALUE;  std::map<CString, FileItem>::iterator it;  LARGE_INTEGER lFileSize;  BOOL bGetSize = FALSE;      if(m_bExport)    m_Assync.SetProgress(_T("[exporting_report]"), 0, false);  else    m_Assync.SetProgress(_T("[compressing_files]"), 0, false);  m_Assync.SetProgress(_T("Calculating total size of files to compress..."), 0, false);    for(it=g_CrashInfo.m_FileItems.begin(); it!=g_CrashInfo.m_FileItems.end(); it++)  {        if(m_Assync.IsCancelled())          goto cleanup;    CString sFileName = it->second.m_sSrcFile.GetBuffer(0);    hFile = CreateFile(sFileName,       GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);     if(hFile==INVALID_HANDLE_VALUE)    {      sMsg.Format(_T("Couldn't open file %s"), sFileName);      m_Assync.SetProgress(sMsg, 0, false);      continue;    }        bGetSize = GetFileSizeEx(hFile, &lFileSize);    if(!bGetSize)    {      sMsg.Format(_T("Couldn't get file size of %s"), sFileName);      m_Assync.SetProgress(sMsg, 0, false);      CloseHandle(hFile);      continue;    }    lTotalSize += lFileSize.QuadPart;    CloseHandle(hFile);    hFile = INVALID_HANDLE_VALUE;  }  sMsg.Format(_T("Total file size for compression is %I64d"), lTotalSize);  m_Assync.SetProgress(sMsg, 0, false);  if(m_bExport)    m_sZipName = m_sExportFileName;    else    m_sZipName = g_CrashInfo.m_sErrorReportDirName + _T(".zip");        sMsg.Format(_T("Creating ZIP archive file %s"), m_sZipName);  m_Assync.SetProgress(sMsg, 1, false);  hZip = zipOpen(strconv.t2a(m_sZipName.GetBuffer(0)), APPEND_STATUS_CREATE);  if(hZip==NULL)  {    m_Assync.SetProgress(_T("Failed to create ZIP file."), 100, true);    goto cleanup;  }  for(it=g_CrashInfo.m_FileItems.begin(); it!=g_CrashInfo.m_FileItems.end(); it++)  {     if(m_Assync.IsCancelled())          goto cleanup;        CString sDstFileName = it->second.m_sDestFile.GetBuffer(0);    CString sFileName = it->second.m_sSrcFile.GetBuffer(0);    CString sDesc = it->second.m_sDesc;    sMsg.Format(_T("Compressing %s"), sDstFileName);    m_Assync.SetProgress(sMsg, 0, false);            HANDLE hFile = CreateFile(sFileName,       GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);     if(hFile==INVALID_HANDLE_VALUE)    {      sMsg.Format(_T("Couldn't open file %s"), sFileName);      m_Assync.SetProgress(sMsg, 0, false);      continue;    }    BY_HANDLE_FILE_INFORMATION fi;    GetFileInformationByHandle(hFile, &fi);    SYSTEMTIME st;    FileTimeToSystemTime(&fi.ftCreationTime, &st);    zip_fileinfo info;    info.dosDate = 0;    info.tmz_date.tm_year = st.wYear;//.........这里部分代码省略.........
开发者ID:doo,项目名称:CrashRpt,代码行数:101,


示例15: PropProc

//.........这里部分代码省略.........			/*			 *	Setup the up/down range			 *	and the tab stop.			 */			SendDlgItemMessage( hDlg, IDC_PROP_TABSPIN, UDM_SETRANGE, 0, MAKELPARAM( 24,2 ));			/*			 *	Setup file modes.			 */			for ( i = FMODE_MSDOS; i <= FMODE_MACINTOSH; i++ )				SendDlgItemMessage( hDlg, IDC_PROP_TYPE, CB_ADDSTRING, 0, ( LPARAM )lpszFileModes[ i ] );			/*			 *	Setup the file size and the			 *	tab size controls.			 */			SetSizeControls( hDlg );			/*			 *	Valid file date?			 */			if ( lpcd->ftFileTime.dwHighDateTime == 0 && lpcd->ftFileTime.dwLowDateTime == 0 )				SetDlgItemText( hDlg, IDC_PROP_DATE, GetString( IDS_NOT_SAVED ));			else			{				FILETIME	ft;				SYSTEMTIME	st;				/*				 *	Convert file time to				 *	system time.				 */				FileTimeToLocalFileTime( &lpcd->ftFileTime, &ft );				FileTimeToSystemTime( &ft, &st );				/*				 *	Format time.				 */				GetTimeFormat( LOCALE_USER_DEFAULT,					       0, //LOCALE_NOUSEROVERRIDE,					       &st,					       NULL,					       szBuffer,					       256 );				/*				 *	Add space.				 */				_tcscat_s( szBuffer, MAX_PATH, _T(" "));				/*				 *	Format date.				 */				GetDateFormat( LOCALE_USER_DEFAULT,					       0, //LOCALE_NOUSEROVERRIDE,					       &st,					       NULL,					       &szBuffer[ _tcslen( szBuffer ) ],					       256 - _tcslen( szBuffer ));				/*				 *	Output result.				 */				SetDlgItemText( hDlg, IDC_PROP_DATE, szBuffer );			}
开发者ID:jcbaar,项目名称:Brainchild,代码行数:66,


示例16: FileTime2utime

local int FileTime2utime(FILETIME *pft, time_t *ut){#ifndef NO_INT64    ULLNG64 NTtime;    NTtime = ((ULLNG64)pft->dwLowDateTime +              ((ULLNG64)pft->dwHighDateTime << 32));    /* underflow and overflow handling */#ifdef CHECK_UTIME_SIGNED_UNSIGNED    if ((time_t)0x80000000L < (time_t)0L)    {        if (NTtime < ((ULLNG64)UNIX_TIME_SMIN_LO +                      ((ULLNG64)UNIX_TIME_SMIN_HI << 32))) {            *ut = (time_t)LONG_MIN;            return FALSE;        }        if (NTtime > ((ULLNG64)UNIX_TIME_SMAX_LO +                      ((ULLNG64)UNIX_TIME_SMAX_HI << 32))) {            *ut = (time_t)LONG_MAX;            return FALSE;        }    }    else#endif /* CHECK_UTIME_SIGNED_UNSIGNED */    {        if (NTtime < ((ULLNG64)UNIX_TIME_ZERO_LO +                      ((ULLNG64)UNIX_TIME_ZERO_HI << 32))) {            *ut = (time_t)0;            return FALSE;        }        if (NTtime > ((ULLNG64)UNIX_TIME_UMAX_LO +                      ((ULLNG64)UNIX_TIME_UMAX_HI << 32))) {            *ut = (time_t)ULONG_MAX;            return FALSE;        }    }    NTtime -= ((ULLNG64)UNIX_TIME_ZERO_LO +               ((ULLNG64)UNIX_TIME_ZERO_HI << 32));    *ut = (time_t)(NTtime / (unsigned long)NT_QUANTA_PER_UNIX);    return TRUE;#else /* NO_INT64 (64-bit integer arithmetics may not be supported) */    /* nonzero if `y' is a leap year, else zero */#   define leap(y) (((y)%4 == 0 && (y)%100 != 0) || (y)%400 == 0)    /* number of leap years from 1970 to `y' (not including `y' itself) */#   define nleap(y) (((y)-1969)/4 - ((y)-1901)/100 + ((y)-1601)/400)    /* daycount at the end of month[m-1] */    static ZCONST ush ydays[] =      { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };    time_t days;    SYSTEMTIME w32tm;    /* underflow and overflow handling */#ifdef CHECK_UTIME_SIGNED_UNSIGNED    if ((time_t)0x80000000L < (time_t)0L)    {        if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) ||            ((pft->dwHighDateTime == UNIX_TIME_SMIN_HI) &&             (pft->dwLowDateTime < UNIX_TIME_SMIN_LO))) {            *ut = (time_t)LONG_MIN;            return FALSE;        if ((pft->dwHighDateTime > UNIX_TIME_SMAX_HI) ||            ((pft->dwHighDateTime == UNIX_TIME_SMAX_HI) &&             (pft->dwLowDateTime > UNIX_TIME_SMAX_LO))) {            *ut = (time_t)LONG_MAX;            return FALSE;        }    }    else#endif /* CHECK_UTIME_SIGNED_UNSIGNED */    {        if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) ||            ((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) &&             (pft->dwLowDateTime < UNIX_TIME_ZERO_LO))) {            *ut = (time_t)0;            return FALSE;        }        if ((pft->dwHighDateTime > UNIX_TIME_UMAX_HI) ||            ((pft->dwHighDateTime == UNIX_TIME_UMAX_HI) &&             (pft->dwLowDateTime > UNIX_TIME_UMAX_LO))) {            *ut = (time_t)ULONG_MAX;            return FALSE;        }    }    FileTimeToSystemTime(pft, &w32tm);    /* set `days' to the number of days into the year */    days = w32tm.wDay - 1 + ydays[w32tm.wMonth-1] +           (w32tm.wMonth > 2 && leap (w32tm.wYear));    /* now set `days' to the number of days since 1 Jan 1970 */    days += 365 * (time_t)(w32tm.wYear - 1970) +            (time_t)(nleap(w32tm.wYear));    *ut = (time_t)(86400L * days + 3600L * (time_t)w32tm.wHour +                   (time_t)(60 * w32tm.wMinute + w32tm.wSecond));    return TRUE;//.........这里部分代码省略.........
开发者ID:AltroCoin,项目名称:altrocoin,代码行数:101,


示例17: test_GetTimeZoneInformation

static void test_GetTimeZoneInformation(void){    char std_name[32], dlt_name[32];    TIME_ZONE_INFORMATION tzinfo, tzinfo1;    BOOL res;    DWORD tz_id;    SYSTEMTIME st, current, utc, local;    FILETIME l_ft, s_ft;    LONGLONG l_time, s_time;    LONG diff;    GetSystemTime(&st);    s_time = system_time_to_minutes(&st);    SetLastError(0xdeadbeef);    res = SystemTimeToFileTime(&st, &s_ft);    ok(res, "SystemTimeToFileTime error %u/n", GetLastError());    SetLastError(0xdeadbeef);    res = FileTimeToLocalFileTime(&s_ft, &l_ft);    ok(res, "FileTimeToLocalFileTime error %u/n", GetLastError());    SetLastError(0xdeadbeef);    res = FileTimeToSystemTime(&l_ft, &local);    ok(res, "FileTimeToSystemTime error %u/n", GetLastError());    l_time = system_time_to_minutes(&local);    tz_id = GetTimeZoneInformation(&tzinfo);    ok(tz_id != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed/n");    trace("tz_id %u (%s)/n", tz_id,          tz_id == TIME_ZONE_ID_DAYLIGHT ? "TIME_ZONE_ID_DAYLIGHT" :          (tz_id == TIME_ZONE_ID_STANDARD ? "TIME_ZONE_ID_STANDARD" :          (tz_id == TIME_ZONE_ID_UNKNOWN ? "TIME_ZONE_ID_UNKNOWN" :          "TIME_ZONE_ID_INVALID")));    WideCharToMultiByte(CP_ACP, 0, tzinfo.StandardName, -1, std_name, sizeof(std_name), NULL, NULL);    WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, dlt_name, sizeof(dlt_name), NULL, NULL);    trace("bias %d, %s - %s/n", tzinfo.Bias, std_name, dlt_name);    trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d/n",        tzinfo.StandardDate.wDay, tzinfo.StandardDate.wMonth,        tzinfo.StandardDate.wYear, tzinfo.StandardDate.wDayOfWeek,        tzinfo.StandardDate.wHour, tzinfo.StandardDate.wMinute,        tzinfo.StandardDate.wSecond, tzinfo.StandardDate.wMilliseconds,        tzinfo.StandardBias);    trace("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d/n",        tzinfo.DaylightDate.wDay, tzinfo.DaylightDate.wMonth,        tzinfo.DaylightDate.wYear, tzinfo.DaylightDate.wDayOfWeek,        tzinfo.DaylightDate.wHour, tzinfo.DaylightDate.wMinute,        tzinfo.DaylightDate.wSecond, tzinfo.DaylightDate.wMilliseconds,        tzinfo.DaylightBias);    diff = (LONG)(s_time - l_time);    ok(diff == tzinfo.Bias + get_tz_bias(&tzinfo, tz_id),       "system/local diff %d != tz bias %d/n",       diff, tzinfo.Bias + get_tz_bias(&tzinfo, tz_id));    ok(SetEnvironmentVariableA("TZ","GMT0") != 0,       "SetEnvironmentVariableA failed/n");    res =  GetTimeZoneInformation(&tzinfo1);    ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed/n");    ok(((tzinfo.Bias == tzinfo1.Bias) && 	(tzinfo.StandardBias == tzinfo1.StandardBias) &&	(tzinfo.DaylightBias == tzinfo1.DaylightBias)),       "Bias influenced by TZ variable/n");     ok(SetEnvironmentVariableA("TZ",NULL) != 0,       "SetEnvironmentVariableA failed/n");    if (!pSystemTimeToTzSpecificLocalTime)    {        win_skip("SystemTimeToTzSpecificLocalTime not available/n");        return;    }    diff = get_tz_bias(&tzinfo, tz_id);    utc = st;    SetLastError(0xdeadbeef);    res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &current);    if (!res && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)    {        win_skip("SystemTimeToTzSpecificLocalTime is not implemented/n");        return;    }    ok(res, "SystemTimeToTzSpecificLocalTime error %u/n", GetLastError());    s_time = system_time_to_minutes(&current);    tzinfo.StandardBias -= 123;    tzinfo.DaylightBias += 456;    res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);    ok(res, "SystemTimeToTzSpecificLocalTime error %u/n", GetLastError());    l_time = system_time_to_minutes(&local);    ok(l_time - s_time == diff - get_tz_bias(&tzinfo, tz_id), "got %d, expected %d/n",       (LONG)(l_time - s_time), diff - get_tz_bias(&tzinfo, tz_id));    /* pretend that there is no transition dates */    tzinfo.DaylightDate.wDay = 0;    tzinfo.DaylightDate.wMonth = 0;    tzinfo.DaylightDate.wYear = 0;//.........这里部分代码省略.........
开发者ID:DeltaYang,项目名称:wine,代码行数:101,


示例18: ACE_OS_TRACE

struct tm *ACE_OS::localtime_r (const time_t *t, struct tm *res){  ACE_OS_TRACE ("ACE_OS::localtime_r");#if defined (ACE_HAS_REENTRANT_FUNCTIONS)# if defined (DIGITAL_UNIX)  ACE_OSCALL_RETURN (::_Plocaltime_r (t, res), struct tm *, 0);# else  ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0);# endif /* DIGITAL_UNIX */#elif defined (ACE_HAS_TR24731_2005_CRT)  ACE_SECURECRTCALL (localtime_s (res, t), struct tm *, 0, res);  return res;#elif !defined (ACE_HAS_WINCE)  ACE_OS_GUARD  ACE_UNUSED_ARG (res);  struct tm * res_ptr = 0;  ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr);  if (res_ptr == 0)    return 0;  else    {      *res = *res_ptr;      return res;    }#elif defined (ACE_HAS_WINCE)  // This is really stupid, converting FILETIME to timeval back and  // forth.  It assumes FILETIME and DWORDLONG are the same structure  // internally.  TIME_ZONE_INFORMATION pTz;  const unsigned short int __mon_yday[2][13] =  {    /* Normal years.  */    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },    /* Leap years.  */    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }  };  ULARGE_INTEGER _100ns;  ::GetTimeZoneInformation (&pTz);  _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 + ACE_Time_Value::FILETIME_to_timval_skew;  FILETIME file_time;  file_time.dwLowDateTime = _100ns.LowPart;  file_time.dwHighDateTime = _100ns.HighPart;  FILETIME localtime;  SYSTEMTIME systime;  FileTimeToLocalFileTime (&file_time, &localtime);  FileTimeToSystemTime (&localtime, &systime);  res->tm_hour = systime.wHour;  if(pTz.DaylightBias!=0)    res->tm_isdst = 1;  else    res->tm_isdst = 1;   int iLeap;   iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));   // based on leap select which group to use   res->tm_mday = systime.wDay;   res->tm_min = systime.wMinute;   res->tm_mon = systime.wMonth - 1;   res->tm_sec = systime.wSecond;   res->tm_wday = systime.wDayOfWeek;   res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;   res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900   res->tm_year = res->tm_year - 1900;   return res;#else  // @@ Same as ACE_OS::localtime (), you need to implement it  //    yourself.  ACE_UNUSED_ARG (t);  ACE_UNUSED_ARG (res);  ACE_NOTSUP_RETURN (0);#endif /* ACE_HAS_REENTRANT_FUNCTIONS */}
开发者ID:BgDestroy,项目名称:mangos,代码行数:83,


示例19: WCMD_HandleTildaModifiers

//.........这里部分代码省略.........      if (exists) {        strcpyW(thisoutput, defaults);        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)          thisoutput[0]='d';        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY)          thisoutput[1]='r';        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)          thisoutput[2]='a';        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)          thisoutput[3]='h';        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)          thisoutput[4]='s';        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED)          thisoutput[5]='c';        /* FIXME: What are 6 and 7? */        if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)          thisoutput[8]='l';        strcatW(finaloutput, thisoutput);      }    }    /* 3. Handle 't' : Date+time (File doesn't have to exist) */    if (memchrW(firstModifier, 't', modifierLen) != NULL) {      SYSTEMTIME systime;      int datelen;      doneModifier = TRUE;      if (exists) {        if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);        /* Format the time */        FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);        GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,                          NULL, thisoutput, MAX_PATH);        strcatW(thisoutput, spaceW);        datelen = strlenW(thisoutput);        GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,                          NULL, (thisoutput+datelen), MAX_PATH-datelen);        strcatW(finaloutput, thisoutput);      }    }    /* 4. Handle 'z' : File length (File doesn't have to exist) */    if (memchrW(firstModifier, 'z', modifierLen) != NULL) {      /* FIXME: Output full 64 bit size (sprintf does not support I64 here) */      ULONG/*64*/ fullsize = /*(fileInfo.nFileSizeHigh << 32) +*/                                  fileInfo.nFileSizeLow;      static const WCHAR fmt[] = {'%','u','/0'};      doneModifier = TRUE;      if (exists) {        if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);        wsprintfW(thisoutput, fmt, fullsize);        strcatW(finaloutput, thisoutput);      }    }    /* 4. Handle 's' : Use short paths (File doesn't have to exist) */    if (memchrW(firstModifier, 's', modifierLen) != NULL) {      if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);      /* Don't flag as doneModifier - %~s on its own is processed later */      GetShortPathNameW(outputparam, outputparam, sizeof(outputparam)/sizeof(outputparam[0]));    }
开发者ID:DeltaYang,项目名称:wine,代码行数:66,


示例20: QueryPerformanceCounter

// Return the current time as an OsTime valuevoid OsDateTimeWnt::getCurTime(OsTime& rTime){#if WINCE    typedef union     {        FILETIME  ft;        uint64_t  int64;    } g_FILETIME;    uint64_t ticks ;    uint64_t freq ;    static bool       sbInitialized = false ;    static g_FILETIME sOsFileTime ;    static uint64_t sLastTicks = 0 ;    static uint64_t sResetTime = 0 ;    QueryPerformanceCounter((LARGE_INTEGER*) &ticks) ;    QueryPerformanceFrequency((LARGE_INTEGER*) &freq) ;    if (!sbInitialized || sOsFileTime.int64 > sResetTime)    {        sbInitialized = true ;        GetSystemTimeAsFileTime(&sOsFileTime.ft);        sResetTime = -1 ; // sOsFileTime.int64 + (freq - 1) ;        sLastTicks = ticks ;    }    else    {        uint64_t delta = ticks - sLastTicks ;        sLastTicks = ticks ;        sOsFileTime.int64 = sOsFileTime.int64 +                 (((uint64_t) 10000000) * (delta / freq)) +                 (((uint64_t) 10000000) * (delta % freq)) / freq ;                    SYSTEMTIME si ;        FileTimeToSystemTime(&sOsFileTime.ft, &si) ;    }   OsTime curTime((long)  ((sOsFileTime.int64 - ((uint64_t) 116444736000000000)) / ((uint64_t) 10000000)),                   (long) ((sOsFileTime.int64 / ((uint64_t) 10)) % ((uint64_t) 1000000)));   rTime = curTime;#else    typedef union     {        FILETIME   ft;        uint64_t   int64;    } g_FILETIME;    static bool       sbInitialized = false ;    static g_FILETIME sOsFileTime ;    static DWORD sLastSystemMSecs = 0 ;    DWORD systemMSecs = timeGetTime();    if (!sbInitialized)    {        sbInitialized = true ;        // Set the precision of timings got from timeGetTime.        timeBeginPeriod(1);        // Resample time, since we changed the precision.        systemMSecs = timeGetTime();        FILETIME sft;        GetSystemTimeAsFileTime(&sft);        // Store in a temp and copy over to prevent data type misalignment issues.        sOsFileTime.ft = sft;        sLastSystemMSecs = systemMSecs ;    }    else    {        DWORD delta = systemMSecs - sLastSystemMSecs ;        sLastSystemMSecs = systemMSecs;        sOsFileTime.int64 = sOsFileTime.int64 +                             10000 * delta;  // convert delta msec to 100ns units                SYSTEMTIME si ;        FileTimeToSystemTime(&sOsFileTime.ft, &si) ;    }   OsTime curTime((long) ((sOsFileTime.int64 -                            ((uint64_t) WINDOWSTIME2UNIXTIME * 10000000))                           / ((uint64_t) 10000000)),                   (long) ((sOsFileTime.int64 / ((uint64_t) 10)) %                           ((uint64_t) 1000000)));   rTime = curTime;#endif}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:91,


示例21: __gnat_localtime_tzoff

void__gnat_localtime_tzoff (const time_t *timer, long *off){  union  {    FILETIME ft_time;    unsigned long long ull_time;  } utc_time, local_time;  SYSTEMTIME utc_sys_time, local_sys_time;  TIME_ZONE_INFORMATION tzi;  BOOL  status = 1;  DWORD tzi_status;  (*Lock_Task) ();#ifdef RTX  tzi_status = GetTimeZoneInformation (&tzi);  *off = tzi.Bias;  if (tzi_status == TIME_ZONE_ID_STANDARD)     /* The system is operating in the range covered by the StandardDate        member. */     *off = *off + tzi.StandardBias;  else if (tzi_status == TIME_ZONE_ID_DAYLIGHT)     /* The system is operating in the range covered by the DaylightDate        member. */     *off = *off + tzi.DaylightBias;  *off = *off * -60;#else  /* First convert unix time_t structure to windows FILETIME format.  */  utc_time.ull_time = ((unsigned long long) *timer + w32_epoch_offset)                      * 10000000ULL;  tzi_status = GetTimeZoneInformation (&tzi);  /* If GetTimeZoneInformation does not return a value between 0 and 2 then     it means that we were not able to retrieve timezone informations.     Note that we cannot use here FileTimeToLocalFileTime as Windows will use     in always in this case the current timezone setting. As suggested on     MSDN we use the following three system calls to get the right information.     Note also that starting with Windows Vista new functions are provided to     get timezone settings that depend on the year. We cannot use them as we     still support Windows XP and Windows 2003.  */  status = (tzi_status >= 0 && tzi_status <= 2)     && FileTimeToSystemTime (&utc_time.ft_time, &utc_sys_time)     && SystemTimeToTzSpecificLocalTime (&tzi, &utc_sys_time, &local_sys_time)     && SystemTimeToFileTime (&local_sys_time, &local_time.ft_time);  if (!status)     /* An error occurs so return invalid_tzoff.  */     *off = __gnat_invalid_tzoff;  else     if (local_time.ull_time > utc_time.ull_time)        *off = (long) ((local_time.ull_time - utc_time.ull_time) / 10000000ULL);     else        *off = - (long) ((utc_time.ull_time - local_time.ull_time) / 10000000ULL);#endif  (*Unlock_Task) ();}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:65,


示例22: ExeclThreadPROC

//.........这里部分代码省略.........			sheet[k]->label(0,3,L"后缀");			sheet[k]->colwidth(4,20*fontsize);			sheet[k]->label(0,4,L"创建时间");			sheet[k]->colwidth(5,20*fontsize);			sheet[k]->label(0,5,L"修改时间");			sheet[k]->colwidth(6,15*fontsize);			sheet[k]->label(0,6,L"文件大小");			sheet[k]->colwidth(7,10*fontsize);			sheet[k]->label(0,7,L"分辨率");			sheet[k]->colwidth(8,5*fontsize);			sheet[k]->label(0,8,L"3D");			outputList.clear();			SQLDB.File_ReadHddPage(outputList,beglist->hdd_nid,true,j*10000,10000);			if(outputList.size() <= 0)				continue;			for(m=1,filebeglist=outputList.begin();filebeglist!=outputList.end();m++,filebeglist++)			{				sprintf(str,"%I64u",filebeglist->file_data.file_nid);				MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 				sheet[k]->label(m,0,wbuff);				sprintf(str,"%s%s",filebeglist->file_data.path,filebeglist->file_data.name);				MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 				sheet[k]->label(m,1,wbuff);				sprintf(str,"%s",MainType2Str(filebeglist->file_data.maintype));				MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 				sheet[k]->label(m,2,wbuff);				MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.type, -1, wbuff, 2048); 				sheet[k]->label(m,3,wbuff);					if(filebeglist->file_data.CreationTime)				{					uli.QuadPart=filebeglist->file_data.CreationTime;					temptime.dwLowDateTime=uli.LowPart;					temptime.dwHighDateTime=uli.HighPart;					FileTimeToSystemTime(&temptime,&systime);					sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", 						systime.wYear,systime.wMonth,systime.wDay,						systime.wHour,systime.wMinute,systime.wSecond);					MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 					sheet[k]->label(m,4,wbuff);				}				if(filebeglist->file_data.LastWriteTime)				{					uli.QuadPart=filebeglist->file_data.LastWriteTime;					temptime.dwLowDateTime=uli.LowPart;					temptime.dwHighDateTime=uli.HighPart;					FileTimeToSystemTime(&temptime,&systime);					sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", 						systime.wYear,systime.wMonth,systime.wDay,						systime.wHour,systime.wMinute,systime.wSecond);					MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 					sheet[k]->label(m,5,wbuff);				}				sprintf(str,"%I64u",filebeglist->file_data.filesize);				MultiByteToWideChar(CP_ACP, 0, str, -1, wbuff, 2048); 				sheet[k]->label(m,6,wbuff);				MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.zidian_fenbianlv , -1, wbuff, 2048); 				sheet[k]->label(m,7,wbuff);								MultiByteToWideChar(CP_ACP, 0, filebeglist->file_data.zidian_3d, -1, wbuff, 2048); 				sheet[k]->label(m,8,wbuff);			}			k++;		}	}		MyhddList.clear();	outputList.clear();	MultiByteToWideChar(CP_ACP, 0, path, -1, wbuff, 2048);  	ret = w.Dump(wbuff);	free(filenum);	free(sheet);	pZogvmDlg->GetDlgItem(IDC_BUTTON_OUTPUTEXECL)->EnableWindow(TRUE);	if (ret != 0)	{		MessageBox(NULL,"导出失败","导出EXECL",MB_OK);		return 0;	}	MessageBox(NULL,"导出完成","导出EXECL",MB_OK);	return 0;}
开发者ID:dulton,项目名称:brpj,代码行数:101,


示例23: CoreP_MFileSystemP_GetFileAttributes

refalrts::FnResult CoreP_MFileSystemP_GetFileAttributes(refalrts::Iter arg_begin, refalrts::Iter arg_end) {  refalrts::Iter bb_0 = arg_begin;  refalrts::Iter be_0 = arg_end;  refalrts::move_left( bb_0, be_0 );  refalrts::move_left( bb_0, be_0 );  refalrts::move_right( bb_0, be_0 );  refalrts::Iter eFileName_b_1;  refalrts::Iter eFileName_e_1;  // e.FileName  eFileName_b_1 = bb_0;  refalrts::use( eFileName_b_1 );  eFileName_e_1 = be_0;  refalrts::use( eFileName_e_1 );  std::vector<char> filename;  refalrts::FnResult res =    string_from_seq(filename, eFileName_b_1, eFileName_e_1);  if( res == refalrts::cRecognitionImpossible ) {    return refalrts::cRecognitionImpossible;  }  WIN32_FIND_DATA find_file_data;  HANDLE hFind = FindFirstFile( & filename[0], & find_file_data );  if( hFind == INVALID_HANDLE_VALUE ) {    refalrts::reset_allocator();    refalrts::Iter res = arg_begin;    refalrts::Iter nSF = 0;    if( ! refalrts::alloc_ident( nSF, & FailsL_<int>::name ) )      return refalrts::cNoMemory;    res = refalrts::splice_elem( res, nSF );    refalrts::use( res );    refalrts::splice_to_freelist( arg_begin, arg_end );    return refalrts::cSuccess;  } else {    std::string full_name( find_file_data.cFileName );    if( ! get_full_name( full_name ) ) {      refalrts::reset_allocator();      refalrts::Iter res = arg_begin;          refalrts::Iter nSF = 0;      if( ! refalrts::alloc_ident( nSF, & FailsL_<int>::name ) )        return refalrts::cNoMemory;          res = refalrts::splice_elem( res, nSF );      refalrts::use( res );      refalrts::splice_to_freelist( arg_begin, arg_end );          return refalrts::cSuccess;    } else {      bool is_directory =        ((find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);      SYSTEMTIME file_system_time = { 0 };      FileTimeToSystemTime(        & find_file_data.ftLastWriteTime, & file_system_time      );      refalrts::reset_allocator();      refalrts::Iter res = arg_begin;      refalrts::Iter nSF = 0;      if( ! refalrts::alloc_ident( nSF, & SuccessL_<int>::name ) )        return refalrts::cNoMemory;      refalrts::Iter n0 = 0;      if( ! refalrts::alloc_open_bracket( n0 ) )        return refalrts::cNoMemory;      refalrts::Iter n1 = 0;      if( ! refalrts::alloc_ident( n1, & DateTimeL_<int>::name ) )        return refalrts::cNoMemory;      refalrts::Iter n2 = 0;      if( ! refalrts::alloc_number( n2, file_system_time.wYear ) )        return refalrts::cNoMemory;      refalrts::Iter n3 = 0;      if( ! refalrts::alloc_number( n3, file_system_time.wMonth ) )        return refalrts::cNoMemory;      refalrts::Iter n4 = 0;      if( ! refalrts::alloc_number( n4, file_system_time.wDay ) )        return refalrts::cNoMemory;      refalrts::Iter n5 = 0;      if( ! refalrts::alloc_number( n5, file_system_time.wHour ) )        return refalrts::cNoMemory;      refalrts::Iter n6 = 0;      if( ! refalrts::alloc_number( n6, file_system_time.wMinute ) )        return refalrts::cNoMemory;      refalrts::Iter n7 = 0;      if( ! refalrts::alloc_number( n7, file_system_time.wSecond ) )        return refalrts::cNoMemory;      refalrts::Iter n8 = 0;      if( ! refalrts::alloc_number( n8, file_system_time.wMilliseconds ) )        return refalrts::cNoMemory;      refalrts::Iter n9 = 0;      if( ! refalrts::alloc_close_bracket( n9 ) )//.........这里部分代码省略.........
开发者ID:Mazdaywik,项目名称:REFAL-1,代码行数:101,


示例24: GetDlgItem

void CZogvmDlg::DisplayerList(){	m_list.DeleteAllItems();	WinfileviewList.clear();	if(0==ListTotal)	{		GetDlgItem(IDC_STATIC_INFO)->SetWindowText("共0条 1/1页");		InvalidateRect(printf_Rect, TRUE);		return ;	}	unsigned long int si,ei;	si=ListNow+1;	if((ListNow+PAGE_MAX_NUM) < ListTotal)		ei=ListNow+PAGE_MAX_NUM ;	else		ei=ListTotal;	switch(ModeFlag)	{	case MODE_DOUBLE:		SQLDB.File_ReadDouble(WinfileviewList,si-1,ei-(si-1));		break;	case MODE_FIND:		if(m_sreach.IsEmpty())			SQLDB.File_Read(SQLstr,WinfileviewList,si-1,ei-(si-1));		else			SQLDB.File_ReadForSearch(SQLstr,m_sreach.GetBuffer(0),WinfileviewList,si-1,ei-(si-1));		break;	case MODE_TRASH:		SQLDB.File_ReadTrash(WinfileviewList,si-1,ei-(si-1));		break;	default:return ;	}	if(WinfileviewList.size()<=0)		return ;	list<struct FILE_VIEW_ST>::iterator beglist;	char str[128];	int i=0;	SYSTEMTIME   systime;	FILETIME  temptime;	ULARGE_INTEGER  uli; 	for(beglist=WinfileviewList.begin();beglist!=WinfileviewList.end();beglist++)	{		//带复选框 LVS_EX_CHECKBOXES		if(MAINTYPE_OTHER == beglist->file_data.maintype )		{			m_list.InsertItem( i,beglist->hdd_data.serno,5);		}		else if( MAINTYPE_SUB == beglist->file_data.maintype)		{			m_list.InsertItem( i,beglist->hdd_data.serno,4);		}		else  if(MAINTYPE_VIDEO == beglist->file_data.maintype )		{			m_list.InsertItem( i,beglist->hdd_data.serno,2);		}		else  if(MAINTYPE_MUSIC == beglist->file_data.maintype )		{			m_list.InsertItem( i,beglist->hdd_data.serno,3);		}		m_list.SetItemText(i,1,beglist->hdd_data.mark);		m_list.SetItemText(i,2,beglist->hdd_data.area);		sprintf(str,"%I64u",beglist->file_data.file_nid);		m_list.SetItemText(i,3,str);		m_list.SetItemText(i,4,beglist->file_data.path);		m_list.SetItemText(i,5,beglist->file_data.name);		m_list.SetItemText(i,6,	MainType2Str(beglist->file_data.maintype));		m_list.SetItemText(i,7,beglist->file_data.type);		if(beglist->file_data.CreationTime)		{			uli.QuadPart=beglist->file_data.CreationTime;			temptime.dwLowDateTime=uli.LowPart;			temptime.dwHighDateTime=uli.HighPart;			FileTimeToSystemTime(&temptime,&systime);			sprintf(str,"%04d-%02d-%02d %02d:%02d:%02d", 				systime.wYear,systime.wMonth,systime.wDay,				systime.wHour,systime.wMinute,systime.wSecond);			m_list.SetItemText(i,8,str);		}		if(beglist->file_data.LastWriteTime)		{			uli.QuadPart=beglist->file_data.LastWriteTime;			temptime.dwLowDateTime=uli.LowPart;			temptime.dwHighDateTime=uli.HighPart;			FileTimeToSystemTime(&temptime,&systime);//.........这里部分代码省略.........
开发者ID:dulton,项目名称:brpj,代码行数:101,


示例25: LDEBUG

std::string GpuCapabilitiesWindows::getFileDate(std::string filename) {    LDEBUG("Retrieving file date (last write date) of system file '" << filename << "' ...");        // add system path to filename    LPTSTR lpBuffer = static_cast<LPTSTR>(new char[1024]);    int len = GetSystemDirectory(        lpBuffer,        1024    );    if (len == 0) {        LWARNING("Failed to detect system directory.");        delete lpBuffer;        return "";    }    std::string systemPath = std::string( static_cast<char*>(lpBuffer), len);    delete lpBuffer;    systemPath.append("//");    systemPath.append(filename);    filename = systemPath;    // create file handle for reading attributes    LDEBUG("Acquiring handle for file '" << filename << "' ...");    HANDLE filehandle = CreateFile( filename.c_str(),         FILE_READ_ATTRIBUTES,        FILE_SHARE_READ,         0,        OPEN_EXISTING,         FILE_ATTRIBUTE_NORMAL,         0 );    if ( filehandle == INVALID_HANDLE_VALUE ) {        LDEBUG("Failed to acquire handle for file '" << filename << "'.");        return "";    }        // read file information    LDEBUG("Reading file information ...");    LPBY_HANDLE_FILE_INFORMATION fileInformation = static_cast<LPBY_HANDLE_FILE_INFORMATION>(new BY_HANDLE_FILE_INFORMATION);    BOOL success = GetFileInformationByHandle(filehandle, fileInformation);    if (success == 0) {        LDEBUG("Failed to read file information of file '" << filename << "'.");        delete fileInformation;        return "";    }    // convert file time to local time    SYSTEMTIME stUTC, stLocal;    DWORD dwRet;    FileTimeToSystemTime(&(fileInformation->ftLastWriteTime), &stUTC);    SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);    // build a string showing the date    LPTSTR lpszString = static_cast<LPTSTR>(new char[1024]);    dwRet = StringCchPrintf(lpszString, 1024,         TEXT("%d-%02d-%02d"),        stLocal.wYear, stLocal.wMonth, stLocal.wDay);    std::string result = std::string( static_cast<char*>(lpszString));    delete lpszString;    LDEBUG("Reading file date successful.");    return result;}
开发者ID:alvatar,项目名称:smartmatter,代码行数:62,


示例26: LoadDIBFromFile

voidLoadDIBFromFile(HBITMAP * hBitmap, LPTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes){    BITMAPFILEHEADER bfh;    BITMAPINFO *bi;    PVOID pvBits;    DWORD dwBytesRead;    HANDLE hFile;    if (!hBitmap)    {        ShowFileLoadError(name);        return;    }    hFile =        CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);    if (hFile == INVALID_HANDLE_VALUE)    {        ShowFileLoadError(name);        return;    }    /* read header and check for 'BM' magic */    ReadFile(hFile, &bfh, sizeof(BITMAPFILEHEADER), &dwBytesRead, NULL);    if (bfh.bfType != 0x4d42)    {        CloseHandle(hFile);        ShowFileLoadError(name);        return;    }    if (time)    {        FILETIME ft;        GetFileTime(hFile, NULL, NULL, &ft);        FileTimeToSystemTime(&ft, time);    }    if (size)        *size = GetFileSize(hFile, NULL);    bi = HeapAlloc(GetProcessHeap(), 0, bfh.bfOffBits - sizeof(BITMAPFILEHEADER));    if (!bi)    {        CloseHandle(hFile);        ShowFileLoadError(name);        return;    }    ReadFile(hFile, bi, bfh.bfOffBits - sizeof(BITMAPFILEHEADER), &dwBytesRead, NULL);    *hBitmap = CreateDIBSection(NULL, bi, DIB_RGB_COLORS, &pvBits, NULL, 0);    ReadFile(hFile, pvBits, bfh.bfSize - bfh.bfOffBits, &dwBytesRead, NULL);    if (hRes)        *hRes = (*bi).bmiHeader.biXPelsPerMeter;    if (vRes)        *vRes = (*bi).bmiHeader.biYPelsPerMeter;    CloseHandle(hFile);    HeapFree(GetProcessHeap(), 0, bi);}
开发者ID:hoangduit,项目名称:reactos,代码行数:61,


示例27: getCPUTime

/*** Returns the amount of CPU time used by the current process,* in second , or -1.0 if an error occurred.*/double getCPUTime(){#if defined(_WIN32)	/* Windows -------------------------------------------------- */	FILETIME createTime;	FILETIME exitTime;	FILETIME kernelTime;	FILETIME userTime;	if (GetProcessTimes(GetCurrentProcess(),&createTime, &exitTime, &kernelTime, &userTime) != -1)	{		SYSTEMTIME userSystemTime;		if (FileTimeToSystemTime(&userTime, &userSystemTime) != -1)			return (double)userSystemTime.wHour * 3600.0 +			(double)userSystemTime.wMinute * 60.0 +			(double)userSystemTime.wSecond +			(double)userSystemTime.wMilliseconds / 1000.0;	}#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))	/* AIX, BSD, Cygwin, HP-UX, Linux, OSX, and Solaris --------- */#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)	/* Prefer high-res POSIX timers, when available. */	{		clockid_t id;		struct timespec ts;#if _POSIX_CPUTIME > 0		/* Clock ids vary by OS.  Query the id, if possible. */		if (clock_getcpuclockid(0, &id) == -1)#endif#if defined(CLOCK_PROCESS_CPUTIME_ID)			/* Use known clock id for AIX, Linux, or Solaris. */			id = CLOCK_PROCESS_CPUTIME_ID;#elif defined(CLOCK_VIRTUAL)			/* Use known clock id for BSD or HP-UX. */			id = CLOCK_VIRTUAL;#else			id = (clockid_t)-1;#endif		if (id != (clockid_t)-1 && clock_gettime(id, &ts) != -1)			return (double)ts.tv_sec +			(double)ts.tv_nsec / 1000000000.0;	}#endif#if defined(RUSAGE_SELF)	{		struct rusage rusage;		if (getrusage(RUSAGE_SELF, &rusage) != -1)			return (double)rusage.ru_utime.tv_sec +			(double)rusage.ru_utime.tv_usec / 1000000.0;	}#endif#if defined(_SC_CLK_TCK)	{		const double ticks = (double)sysconf(_SC_CLK_TCK);		struct tms tms;		if (times(&tms) != (clock_t)-1)			return (double)tms.tms_utime / ticks;	}#endif#if defined(CLOCKS_PER_SEC)	{		clock_t cl = clock();		if (cl != (clock_t)-1)			return (double)cl / (double)CLOCKS_PER_SEC;	}#endif#endif	return -1;		/* Failed. */}
开发者ID:Hielamon,项目名称:VSCommonTest,代码行数:79,


示例28: fprintf

BOOL LASreaderQFIT::open(const char* file_name){  if (file_name == 0)  {    fprintf(stderr,"ERROR: fine name pointer is zero/n");    return FALSE;  }  // open file  file = fopen(file_name, "rb");  if (file == 0)  {    fprintf(stderr, "ERROR: cannot open file '%s'/n", file_name);    return FALSE;  }  // create input stream  ByteStreamIn* in;  if (IS_LITTLE_ENDIAN())    in = new ByteStreamInFileLE(file);  else    in = new ByteStreamInFileBE(file);  // clean the header  header.clean();  // set projection  LASvlr_key_entry geo_keys[4];  // projected coordinates  geo_keys[0].key_id = 1024; // GTModelTypeGeoKey  geo_keys[0].tiff_tag_location = 0;  geo_keys[0].count = 1;  geo_keys[0].value_offset = 2; // ModelTypeGeographic  // ellipsoid used with latitude/longitude coordinates  geo_keys[1].key_id = 2048; // GeographicTypeGeoKey  geo_keys[1].tiff_tag_location = 0;  geo_keys[1].count = 1;  geo_keys[1].value_offset = 4326; // GCS_WGS_84   // vertical units  geo_keys[2].key_id = 4099; // VerticalUnitsGeoKey  geo_keys[2].tiff_tag_location = 0;  geo_keys[2].count = 1;  geo_keys[2].value_offset = 9001; // meter  // vertical datum  geo_keys[3].key_id = 4096; // VerticalCSTypeGeoKey  geo_keys[3].tiff_tag_location = 0;  geo_keys[3].count = 1;  geo_keys[3].value_offset = 5030; // VertCS_WGS_84_ellipsoid  header.set_geo_keys(4, geo_keys);  // maybe set creation date#ifdef _WIN32  WIN32_FILE_ATTRIBUTE_DATA attr;	SYSTEMTIME creation;  GetFileAttributesEx(file_name, GetFileExInfoStandard, &attr);	FileTimeToSystemTime(&attr.ftCreationTime, &creation);  int startday[13] = {-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};  header.file_creation_day = startday[creation.wMonth] + creation.wDay;  header.file_creation_year = creation.wYear;  // leap year handling  if ((((creation.wYear)%4) == 0) && (creation.wMonth > 2)) header.file_creation_day++;#else  header.file_creation_day = 333;  header.file_creation_year = 2011;#endif  return open(in);}
开发者ID:bsmaldon,项目名称:lag,代码行数:78,



注:本文中的FileTimeToSystemTime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FileToString函数代码示例
C++ FileTimeToLocalFileTime函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。