• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetTimeFormat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: WriteDebugLog

VOID
WriteDebugLog(LPSTR lpFile, UINT iLine, LPSTR lpFunc, LPWSTR lpMsg, ...)
{
    LARGE_INTEGER FileSize, MoveTo, NewPos;
    WCHAR szMsg[MAX_STR_LEN * 3];
    WCHAR szText[MAX_STR_LEN * 4], szTime[MAX_STR_LEN];
    DWORD dwBytesWritten;
    va_list args;

    if (!hDebugLog || hDebugLog == INVALID_HANDLE_VALUE)
        return;

    MoveTo.QuadPart = 0;
    if (!SetFilePointerEx(hDebugLog, MoveTo, &NewPos, FILE_END))
        return;

    if (!GetFileSizeEx(hDebugLog, &FileSize))
        return;

    LockFile(hDebugLog, (DWORD_PTR)NewPos.QuadPart, 0, (DWORD_PTR)FileSize.QuadPart, 0);

    GetTimeFormat(LOCALE_USER_DEFAULT,
                  0, NULL, NULL, szTime,
                  MAX_STR_LEN);

    va_start(args, lpMsg);
    StringCbVPrintf(szMsg, sizeof(szMsg), lpMsg, args);
    va_end(args);

    StringCbPrintf(szText, sizeof(szText),
                   L"[%s] %S:%ld %S(): \"%s\"\r\n",
                   szTime, lpFile, iLine, lpFunc, szMsg);

    WriteFile(hDebugLog, szText,
              wcslen(szText) * sizeof(WCHAR),
              &dwBytesWritten, NULL);

    UnlockFile(hDebugLog, (DWORD_PTR)NewPos.QuadPart, 0, (DWORD_PTR)FileSize.QuadPart, 0);
}
开发者ID:WilkGardariki,项目名称:aspia,代码行数:39,代码来源:debug.c


示例2: Add2LogWithTime

void Add2LogWithTime(TCHAR *txt)
{
	BOOL bLogTime = TRUE;
	TCHAR str[512];
	TCHAR lpTimeStr[128];
	TCHAR lpDateStr[128];
	LONG res;
	wsprintf(str,L"");
	//Read the system time
	res = GetTimeFormat(LOCALE_SYSTEM_DEFAULT,
							TIME_FORCE24HOURFORMAT,
							NULL,
							L"hh:mm:ss",
							lpTimeStr,
							sizeof (lpTimeStr ) * sizeof(TCHAR));
	if (res == 0)
	{
		wcscpy(lpTimeStr, L"err");
	}

	//Read the system date
	res = GetDateFormat(  LOCALE_SYSTEM_DEFAULT,
						  NULL,
						  NULL,
						  L"dd.MM.yyyy",
						  lpDateStr,
						  sizeof (lpDateStr) * sizeof(TCHAR));
	if (res == 0)
	{
		wcscpy(lpDateStr, L"err");
	}

	if (bLogTime == TRUE)
		wsprintf(str, L"%s %s\t%s", lpDateStr, lpTimeStr , txt);
	else
		wsprintf(str, L"%s", txt);
	writefile(str);

}
开发者ID:hjgode,项目名称:logging_ce,代码行数:39,代码来源:log2file.cpp


示例3: toLocalSystemTime

void DateTime::toString(StringStorage *target) const
{
  SYSTEMTIME systemTime;

  toLocalSystemTime(&systemTime);

  const size_t dateStringMaxLength = 255;

  TCHAR dateString[dateStringMaxLength + 1];

  if (GetDateFormat(LOCALE_USER_DEFAULT,
        DATE_SHORTDATE,
        &systemTime,
        0,
        dateString,
        dateStringMaxLength) == 0) {
    // TODO: Process this error.
  }

  target->setString(dateString);
  target->appendChar(_T(' '));

  const size_t timeStringMaxLength = 255;

  TCHAR timeString[timeStringMaxLength + 1];

  if (GetTimeFormat(
        LOCALE_USER_DEFAULT,
        0,
        &systemTime,
        0,
        timeString,
        timeStringMaxLength) == 0) {
    // TODO: Process this error.
  }

  target->appendString(timeString);
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:38,代码来源:DateTime.cpp


示例4: GetLocalTime

void Log::ReallyPrint(LPCTSTR format, va_list ap) 
{

	SYSTEMTIME current;
	GetLocalTime(&current);
	if (memcmp(&m_lastLogT, &current, sizeof(SYSTEMTIME)) != 0)
	{
		m_lastLogT = current;
		char time_str[50] = {0};
		char date_str[50] = {0};

		int nRet = GetDateFormat(LOCALE_USER_DEFAULT, NULL, &current, "ddd yyyy-MM-dd",  date_str, sizeof(date_str));
		nRet = GetTimeFormat(LOCALE_USER_DEFAULT,NULL, &current,"hh:mm:ss",time_str,sizeof(time_str));
		
		char time_buf[50];
		sprintf(time_buf, "%s %s\r\n",date_str, time_str);		
		ReallyPrintLine(time_buf);
	}


	// Prepare the complete log message
	TCHAR line[LINE_BUFFER_SIZE];
	memset(line, 0, sizeof(line));
	_vsnprintf(line, sizeof(line) - 2 * sizeof(TCHAR), format, ap);
	line[LINE_BUFFER_SIZE-2] = (TCHAR)'\0';
#if (!defined(_UNICODE) && !defined(_MBCS))
	int len = strlen(line);
	if (len > 0 && len <= sizeof(line) - 2 * sizeof(TCHAR) && line[len-1] == (TCHAR)'\n') {
		// Replace trailing '\n' with MS-DOS style end-of-line.
		line[len-1] = (TCHAR)'\r';
		line[len] =   (TCHAR)'\n';
		line[len+1] = (TCHAR)'\0';
	}
#endif
	
	ReallyPrintLine(line);
	ReallyPrintLine(TEXT("\n"));
}
开发者ID:tianyx,项目名称:TxUIProject,代码行数:38,代码来源:Log.cpp


示例5: throw

void CCoBroker::AddList(const cLog::cEventDesc &EventDesc, const TCHAR *Item, ...) throw( )
{
	try
	{
		// Exit if verbosity level is _NO_TRACE_ of high than defined level
		if( (_NO_TRACE_ == EventDesc.getVerbosity()) || (EventDesc.getVerbosity() >= _TRACE_CALLS_) )
			return;
		SYSTEMTIME SysTime;
		GetLocalTime(&SysTime);
		TCHAR Buf[MAX_PATH];
		tstring TimeStr;
		if(!GetTimeFormat(LOCALE_USER_DEFAULT,0,&SysTime,NULL,Buf,MAX_PATH))
			TimeStr += _T("Invalid time");
		else
			TimeStr += Buf;
		TimeStr += _T("> ");

		va_list vl;
		tstring str;
		for(va_start(vl, Item); Item; Item=va_arg(vl, PTCHAR))
		{
			str += Item;
		}
		va_end(vl);

		TimeStr += str;
		TimeStr+=_T(" ");
		if (EventDesc.getCallStack())
			TimeStr+=EventDesc.getCallStack();//call stack

		//HRESULT result;
		//result=NotifyLogMessage(CComBSTR(TimeStr.c_str()),EventDesc.getSeverity());
		::PostMessage(m_hWnd,m_msgFireNotifyLogMessage, reinterpret_cast<WPARAM>(new CComBSTR(TimeStr.c_str())),EventDesc.getSeverity());
	}
	catch(...)
	{
	}
}
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:38,代码来源:CCoBroker.cpp


示例6: isc_time_formattimestamp

void
isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) {
	FILETIME localft;
	SYSTEMTIME st;
	char DateBuf[50];
	char TimeBuf[50];

	static const char badtime[] = "99-Bad-9999 99:99:99.999";

	REQUIRE(len > 0);
	if (FileTimeToLocalFileTime(&t->absolute, &localft) &&
	    FileTimeToSystemTime(&localft, &st)) {
		GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, "dd-MMM-yyyy",
			      DateBuf, 50);
		GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER|
			      TIME_FORCE24HOURFORMAT, &st, NULL, TimeBuf, 50);

		snprintf(buf, len, "%s %s.%03u", DateBuf, TimeBuf,
			 st.wMilliseconds);

	} else
		snprintf(buf, len, badtime);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:23,代码来源:time.c


示例7: ConvertPGPTimeToString

static void ConvertPGPTimeToString(PGPTime time,
								   char *dateString, 
								   PGPUInt32 dateStrLength,
								   char *timeString,
								   PGPUInt32 timeStrLength) 
{
	SYSTEMTIME	systemtime;
	time_t		ttTime;
	struct tm*	ptm;

	ttTime = PGPGetStdTimeFromPGPTime(time);
	ptm = localtime(&ttTime);

	StdTimeToSystemTime(ptm, &systemtime);

	GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systemtime, 
		NULL, dateString, dateStrLength);

	GetTimeFormat(LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &systemtime,
		NULL, timeString, timeStrLength);

	return;
}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:23,代码来源:VerificationBlock.c


示例8: ZeroMemory

char *GetTimeLeft(DWORD dwTimeLeft,
                  char *szTimeString,
                  DWORD dwTimeStringBufSize)
{
  DWORD      dwTimeLeftPP;
  SYSTEMTIME stTime;

  ZeroMemory(&stTime, sizeof(stTime));
  dwTimeLeftPP         = dwTimeLeft + 1;
  stTime.wHour         = (unsigned)(dwTimeLeftPP / 60 / 60);
  stTime.wMinute       = (unsigned)((dwTimeLeftPP / 60) % 60);
  stTime.wSecond       = (unsigned)(dwTimeLeftPP % 60);

  ZeroMemory(szTimeString, dwTimeStringBufSize);
  /* format time string using user's local time format information */
  GetTimeFormat(LOCALE_USER_DEFAULT,
                TIME_NOTIMEMARKER|TIME_FORCE24HOURFORMAT,
                &stTime,
                NULL,
                szTimeString,
                dwTimeStringBufSize);

  return(szTimeString);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:24,代码来源:xpnetHook.cpp


示例9: UpdateLocaleSample

/* Update all locale samples */
static VOID
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
{
    TCHAR OutBuffer[MAX_SAMPLES_STR_SIZE];

    /* Get number format sample */
    GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
                    MAX_SAMPLES_STR_SIZE);
    SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
                 WM_SETTEXT, 0, (LPARAM)OutBuffer);

    /* Get monetary format sample */
    GetCurrencyFormat(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
                      OutBuffer, MAX_SAMPLES_STR_SIZE);
    SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
                 WM_SETTEXT, 0, (LPARAM)OutBuffer);

    /* Get time format sample */
    GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_SAMPLES_STR_SIZE);
    SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
        WM_SETTEXT,
        0,
        (LPARAM)OutBuffer);

    /* Get short date format sample */
    GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
        MAX_SAMPLES_STR_SIZE);
    SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
        0, (LPARAM)OutBuffer);

    /* Get long date sample */
    GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
        MAX_SAMPLES_STR_SIZE);
    SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
        WM_SETTEXT, 0, (LPARAM)OutBuffer);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:37,代码来源:generalp.c


示例10: defined

/* Ad-hoc API exported by Opera: date and time */
/* static */ OP_STATUS
ES_ImportedAPI::FormatLocalTime(ES_ImportedAPI::DateFormatSpec how, uni_char *buf, unsigned length, ES_ImportedAPI::TimeElements* time)
{
#if defined(MSWIN) || defined(WINGOGI)
    SYSTEMTIME dtime;
    unsigned len = 0;

    dtime.wYear = time->year;
    dtime.wMonth = time->month + 1;
    dtime.wDayOfWeek = time->day_of_week;
    dtime.wDay = time->day_of_month;
    dtime.wHour = time->hour;
    dtime.wMinute = time->minute;
    dtime.wSecond = time->second;
    dtime.wMilliseconds = time->millisecond;

	if (how == GET_DATE_AND_TIME || how == GET_DATE)
		if ((len = GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &dtime, NULL, buf, length)) == 0)
			goto failure;

	if (how == GET_DATE_AND_TIME)
		buf[len - 1] = ' ';

	if (how == GET_DATE_AND_TIME || how == GET_TIME)
        if ((len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &dtime, NULL, buf + len, length - len)) == 0)
			goto failure;

	return OpStatus::OK;

failure:
	// It seems that GetDateFormat or GetTimeFormat fails on Windows 95 (and perhaps some
	// installations of Windows 98).  It would be bad to return an empty string, so just
	// handle it by the default action.
#endif // MSWIN || WINGOGI
	return OpStatus::ERR;
}
开发者ID:prestocore,项目名称:browser,代码行数:37,代码来源:ecma_pi.cpp


示例11: ConvertDate

void ConvertDate(const FILETIME& ft,wchar_t *DateText,wchar_t *TimeText)
{
	if (ft.dwHighDateTime==0 && ft.dwLowDateTime==0)
	{
		if (DateText!=NULL)
			*DateText=0;

		if (TimeText!=NULL)
			*TimeText=0;

		return;
	}

	SYSTEMTIME st;
	FILETIME ct;
	FileTimeToLocalFileTime(&ft,&ct);
	FileTimeToSystemTime(&ct,&st);

	if (TimeText!=NULL)
		GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, 0, TimeText, MAX_DATETIME);

	if (DateText!=NULL)
		GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, 0, DateText, MAX_DATETIME);
}
开发者ID:CyberShadow,项目名称:FAR,代码行数:24,代码来源:Pmix.cpp


示例12: GetTimeFormat

STDMETHODIMP CBaseGraph::QueryPreferredFormat(GUID* pFormat)
{
    return GetTimeFormat(pFormat);
}
开发者ID:DanHenebry,项目名称:mpc-hc,代码行数:4,代码来源:BaseGraph.cpp


示例13: MyGetEnvironmentInfo

static void	MyGetEnvironmentInfo (void)
{
    static FilePath	stMyApplicationPath;
    static DWORD	stMyDummy;
    static DWORD	stMyVersionSize;
    static char		*stMyVersionInfo;
    static UINT		stMyVersionInfoSize;
    static char		stMyTempString [256];
    static HANDLE	stMyFile;
    static DWORD	stMyFileSize;
    static FILETIME	stMyFileTime, stMyDummy1, stMyDummy2;
    static SYSTEMTIME	stMySystemTime;
    	
    //
    // Line 1: Date: Oct 20, 2000
    //
    
    // Start with current date label
    MyAddToBuffer ("Date: ");

    // Add the current date
    GetDateFormat (LOCALE_USER_DEFAULT, 0, NULL, "MMM d yyyy", 
        stMyTempString, sizeof (stMyTempString));
    MyAddToBuffer (stMyTempString);

    // Add a space
    MyAddToBuffer (" ");
    
    // Add the current time    
    GetTimeFormat (LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, 
        stMyTempString, sizeof (stMyTempString));
    MyAddToBuffer (stMyTempString);
    
    // Add a newline
    MyAddToBuffer ("\r\n\r\n");
    
    //
    // Line 2: File Name: d:\ready\ready.exe
    //
    
    // Start with file name label
    MyAddToBuffer ("File Name: ");

    // Add the application path
    GetModuleFileName (NULL, stMyApplicationPath, sizeof (stMyApplicationPath));
    MyAddToBuffer (stMyApplicationPath);

    // Add a newline
    MyAddToBuffer ("\r\n");
    
    //
    // Line 3 (Maybe): Version: 1.0.2  [Mini/Restricted/IBM/71]
    //

    // Start with the version label
    MyAddToBuffer ("Version: ");
    
    // Set to empty string by default
    stMyVersionSize = GetFileVersionInfoSize (stMyApplicationPath, &stMyDummy);
    if ((stMyVersionSize != 0) && (stMyVersionSize <= stCrashBufferLeft))
    {
	if (GetFileVersionInfo (stMyApplicationPath, stMyDummy, 
				stCrashBufferLeft, stCrashBufferPtr))
	{
	    if (VerQueryValue (stCrashBufferPtr, 
			    "\\StringFileInfo\\04090000\\ProductVersion", 
			    &stMyVersionInfo, &stMyVersionInfoSize))
	    {			    
		// Add the version number (size includes \0)
		memmove (stCrashBufferPtr, stMyVersionInfo, 
			 stMyVersionInfoSize);
		stCrashBufferLeft -= stMyVersionInfoSize - 1;
		stCrashBufferPtr += stMyVersionInfoSize - 1; 
	    }
	    else
	    {
	    	MyAddToBuffer ("Unknown");
	    }
	}
	else
	{
	    MyAddToBuffer ("Unknown");
	}
    }
    else
    {
    	MyAddToBuffer ("Unknown");
    }
    
    if (gProgram.globalsInitialized)
    {
	// Add a spaces
	MyAddToBuffer ("  [");

	if (gProgram.miniVersion)
            MyAddToBuffer ("Mini/");
	if (gProgram.restrictedVersion)
            MyAddToBuffer ("Restricted/");
	if (gProgram.assistedByIBM)
            MyAddToBuffer ("IBM/");
//.........这里部分代码省略.........
开发者ID:Open-Turing-Project,项目名称:OpenTuring,代码行数:101,代码来源:edfail.c


示例14: GetTimeFormat

STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat)
{
	return GetTimeFormat(pFormat);
}
开发者ID:Samangan,项目名称:mpc-hc,代码行数:4,代码来源:BaseMuxer.cpp


示例15: SecMgrpDlgProcInitReport

LONG
SecMgrpDlgProcInitReport(
    HWND hwnd,
    UINT wMsg,
    DWORD wParam,
    LONG lParam
    )
/*++

Routine Description:

    This function is the dialog process for the dialog that informs the user
    that a new report file is being initialized.  It asks the user to be patient
    and then goes about notifying all the smedlys of the new report file.

Arguments

    None - all information is available in module-wide variables.


Return Values:


--*/
{
    HWND
        Button;

    HCURSOR
        hCursor;

    DWORD
        StringId,
        OutputLineLength;

    BOOL
        Result;

    TCHAR
        OutputLine[SECMGR_MAX_RESOURCE_STRING_LENGTH];


    switch (wMsg) {

    case WM_INITDIALOG:

        if (!SecMgrpReportActive) {
            EndDialog(hwnd, 0);
            return(TRUE);
        }


        SetForegroundWindow(hwnd);
        ShowWindow(hwnd, SW_NORMAL);

        //
        // Change the cursor to an hourglass
        //

        hCursor = SetCursor( LoadCursor(NULL, IDC_WAIT) );
        ShowCursor(TRUE);


        //
        // put header information in the new report file
        //


        //
        // time
        //

        LoadString( SecMgrphInstance,
                    SECMGRP_STRING_REPORT_TIME,
                    OutputLine,
                    sizeof(OutputLine)
                    );
        SecMgrPrintReportLine( OutputLine );

        OutputLineLength = GetTimeFormat( (SHORT)NtCurrentTeb()->CurrentLocale,
                                          TIME_FORCE24HOURFORMAT,     // Flags
                                          NULL,                       // use current time
                                          NULL,                       // Format for current locale
                                          OutputLine,                 // Receives time string
                                          sizeof(OutputLine)
                                          );
        ASSERT(OutputLineLength != 0);
        SecMgrPrintReportLine( OutputLine );


        //
        // Date
        //

        LoadString( SecMgrphInstance,
                    SECMGRP_STRING_REPORT_DATE,
                    OutputLine,
                    sizeof(OutputLine)
                    );
        SecMgrPrintReportLine( OutputLine );
//.........这里部分代码省略.........
开发者ID:mingpen,项目名称:OpenNT,代码行数:101,代码来源:report.c


示例16: EditPrint


//.........这里部分代码省略.........
                          0,
                          0, 0, 0,
                          0, 0, 0,
                          L"Arial");
  SelectObject(hdc, fontFooter);
  GetTextMetrics(hdc, &tm);
  footerLineHeight = tm.tmHeight + tm.tmExternalLeading;

  if (iPrintFooter == 1)
    footerLineHeight = 0;

  di.lpszDocName = pszDocTitle;
  di.lpszOutput = nullptr;
  di.lpszDatatype = nullptr;
  di.fwType = 0;
  if (StartDoc(hdc, &di) < 0) {
    DeleteDC(hdc);
    if (fontHeader)
      DeleteObject(fontHeader);
    if (fontFooter)
      DeleteObject(fontFooter);
    return FALSE;
  }

  // Get current date...
  SYSTEMTIME st;
  GetLocalTime(&st);
  GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,nullptr,dateString,MIDSZ_BUFFER);

  // Get current time...
  if (iPrintHeader == 0)
  {
    WCHAR timeString[SMALL_BUFFER] = { L'\0' };
    GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,nullptr,timeString,SMALL_BUFFER);
    StringCchCat(dateString,COUNTOF(dateString),L" ");
    StringCchCat(dateString,COUNTOF(dateString),timeString);
  }

  // Set print color mode
  int printColorModes[5] = {
    SC_PRINT_NORMAL,
    SC_PRINT_INVERTLIGHT,
    SC_PRINT_BLACKONWHITE,
    SC_PRINT_COLOURONWHITE,
    SC_PRINT_COLOURONWHITEDEFAULTBG };
  SendMessage(hwnd,SCI_SETPRINTCOLOURMODE,printColorModes[iPrintColor],0);

  // Set print zoom...
  SendMessage(hwnd,SCI_SETPRINTMAGNIFICATION,(WPARAM)iPrintZoom,0);

  lengthDoc = (int)SendMessage(hwnd,SCI_GETLENGTH,0,0);
  lengthDocMax = lengthDoc;
  lengthPrinted = 0;

  // Requested to print selection
  if (pdlg.Flags & PD_SELECTION) {
    if (startPos > endPos) {
      lengthPrinted = endPos;
      lengthDoc = startPos;
    } else {
      lengthPrinted = startPos;
      lengthDoc = endPos;
    }

    if (lengthPrinted < 0)
      lengthPrinted = 0;
开发者ID:gencer,项目名称:Notepad3,代码行数:67,代码来源:Print.cpp


示例17: DrawIdleScreen

void DrawIdleScreen(void)
{
  unsigned char msd;
  unsigned char lsd;

  unsigned char Row = 6;
  unsigned char Col = 0;

  int Minutes;

  /* display hour */
  int Hour = GetRTCHOUR();

  /* if required convert to twelve hour format */
  if ( GetTimeFormat() == TWELVE_HOUR )
  {
    if ( Hour == 0 )
    {
      Hour = 12;
    }
    else if ( Hour > 12 )
    {
      Hour -= 12;
    }
  }

  msd = Hour / 10;
  lsd = Hour % 10;

  /* if first digit is zero then leave location blank */
  if ( msd != 0 )
  {
    WriteTimeDigit(msd,Row,Col,LEFT_JUSTIFIED);
  }
  Col += 1;
  WriteTimeDigit(lsd,Row,Col,RIGHT_JUSTIFIED);
  Col += 2;

  /* the colon takes the first 5 bits on the byte*/
  WriteTimeColon(Row,Col,RIGHT_JUSTIFIED);
  Col+=1;

  /* display minutes */
  Minutes = GetRTCMIN();
  msd = Minutes / 10;
  lsd = Minutes % 10;
  WriteTimeDigit(msd,Row,Col,RIGHT_JUSTIFIED);
  Col += 2;
  WriteTimeDigit(lsd,Row,Col,LEFT_JUSTIFIED);

  if ( nvDisplaySeconds )
  {
    /* the final colon's spacing isn't quite the same */
    int Seconds = GetRTCSEC();
    msd = Seconds / 10;
    lsd = Seconds % 10;

    Col +=2;
    WriteTimeColon(Row,Col,LEFT_JUSTIFIED);
    Col += 1;
    WriteTimeDigit(msd,Row,Col,LEFT_JUSTIFIED);
    Col += 1;
    WriteTimeDigit(lsd,Row,Col,RIGHT_JUSTIFIED);

  }
  else /* now things starting getting fun....*/
  {
    DisplayAmPm();

    if ( QueryBluetoothOn() == 0 )
    {
      CopyColumnsIntoMyBuffer(pBluetoothOffIdlePageIcon,
                              IDLE_PAGE_ICON_STARTING_ROW,
                              IDLE_PAGE_ICON_SIZE_IN_ROWS,
                              IDLE_PAGE_ICON_STARTING_COL,
                              IDLE_PAGE_ICON_SIZE_IN_COLS);
    }
    else if ( QueryPhoneConnected() == 0 )
    {
      CopyColumnsIntoMyBuffer(pPhoneDisconnectedIdlePageIcon,
                              IDLE_PAGE_ICON_STARTING_ROW,
                              IDLE_PAGE_ICON_SIZE_IN_ROWS,
                              IDLE_PAGE_ICON_STARTING_COL,
                              IDLE_PAGE_ICON_SIZE_IN_COLS);
    }
    else
    {
      if ( QueryBatteryCharging() )
      {
        CopyColumnsIntoMyBuffer(pBatteryChargingIdlePageIconType2,
                                IDLE_PAGE_ICON2_STARTING_ROW,
                                IDLE_PAGE_ICON2_SIZE_IN_ROWS,
                                IDLE_PAGE_ICON2_STARTING_COL,
                                IDLE_PAGE_ICON2_SIZE_IN_COLS);
      }
      else
      {
        unsigned int bV = 3500;

        if ( bV < 3500 )
//.........这里部分代码省略.........
开发者ID:kiapper,项目名称:Watch,代码行数:101,代码来源:IdlePageMain.c


示例18: CallPeerSeeking

STDMETHODIMP CStreamSwitcherPassThru::GetTimeFormat(GUID* pFormat)
{
    CallPeerSeeking(GetTimeFormat(pFormat));
}
开发者ID:EchoLiao,项目名称:mpc-hc,代码行数:4,代码来源:StreamSwitcher.cpp


示例19: MakeFormat


//.........这里部分代码省略.........
			while(*fmt == 'Y') { n *= 10; ++fmt; }
			if(n < m_AltYear) {
				n = 1; while(n < m_AltYear) n *= 10;
			}
			for(;;) {
				*out++ = (char)((m_AltYear % n) / (n/10)) + '0';
				if(n == 10) break;
				n /= 10;
			}
		} else if(*fmt == 'g') {
			for(pos=m_EraStr; *pos&&*fmt=='g'; ){
				char* p2 = CharNextExA(m_codepage, pos, 0);
				while(pos != p2) *out++ = *pos++;
				++fmt;
			}
			while(*fmt == 'g') fmt++;
		}
		
		else if(*fmt == 'L' && strncmp(fmt, "LDATE", 5) == 0) {
			GetDateFormat(LOCALE_USER_DEFAULT,
						  DATE_LONGDATE, pt, NULL, out, (int)(bufend-out));
			for(; *out; ++out);
			fmt += 5;
		}
		
		else if(*fmt == 'D' && strncmp(fmt, "DATE", 4) == 0) {
			GetDateFormat(LOCALE_USER_DEFAULT,
						  DATE_SHORTDATE, pt, NULL, out, (int)(bufend-out));
			for(; *out; ++out);
			fmt += 4;
		}
		
		else if(*fmt == 'T' && strncmp(fmt, "TIME", 4) == 0) {
			GetTimeFormat(LOCALE_USER_DEFAULT,
						  0, pt, NULL, out, (int)(bufend-out));
			for(; *out; ++out);
			fmt += 4;
		} else if(*fmt == 'S') { // uptime
			int width, padding, num;
			const char* old_fmt = ++fmt;
			char specifier = api.GetFormat(&fmt, &width, &padding);
			if(!TickCount) TickCount = api.GetTickCount64();
			switch(specifier){
			case 'd'://days
				num = (int)(TickCount/86400000);
				break;
			case 'a'://hours total
				num = (int)(TickCount/3600000);
				break;
			case 'h'://hours (max 24)
				num = (TickCount/3600000)%24;
				break;
			case 'n'://minutes
				num = (TickCount/60000)%60;
				break;
			case 's'://seconds
				num = (TickCount/1000)%60;
				break;
			case 'T':{// ST, uptime as h:mm:ss
				ULONGLONG past = TickCount/1000;
				int hour, minute;
				num = past%60; past /= 60;
				minute = past%60; past /= 60;
				hour = (int)past;
				
				out += api.WriteFormatNum(out, hour, width, padding);
开发者ID:dubepaul,项目名称:T-Clock,代码行数:67,代码来源:format.c


示例20: oLock

void CLibraryFrame::RunLocalSearch(CQuerySearch* pSearch)
{
	CWaitCursor pCursor;

	pSearch->BuildWordList( true, true );

	CSingleLock oLock( &Library.m_pSection, TRUE );

	CAlbumFolder* pRoot = Library.GetAlbumRoot();
	if ( ! pRoot ) return;

	CAlbumFolder* pFolder = pRoot->GetFolderByURI( CSchema::uriSearchFolder );
	if ( pFolder == NULL )
	{
		pFolder = pRoot->AddFolder( CSchema::uriSearchFolder, L"Search Results" );
		if ( pFolder->m_pSchema != NULL )
		{
			int nColon = pFolder->m_pSchema->m_sTitle.Find( L':' );
			if ( nColon >= 0 )
				pFolder->m_sName = pFolder->m_pSchema->m_sTitle.Mid( nColon + 1 );
		}
	}
	else
	{
		// Get translated name of the default search folder
		// We will clear it, not others as user may want to keep several folders
		CString strFolderName;
		int nColon = pFolder->m_pSchema->m_sTitle.Find( L':' );
		if ( nColon >= 0 )
			strFolderName = pFolder->m_pSchema->m_sTitle.Mid( nColon + 1 );
		if ( ! strFolderName.IsEmpty() )
			pFolder	= pRoot->GetFolder( strFolderName );

		if ( pFolder == NULL )
		{
			pFolder = pRoot->AddFolder( CSchema::uriSearchFolder, L"Search Results" );
			if ( pFolder->m_pSchema != NULL && ! strFolderName.IsEmpty() )
				pFolder->m_sName = strFolderName;
		}
		else
			pFolder->Clear();
	}

	if ( pFolder->m_pSchema )
	{
		CString strDate, strTime;
		SYSTEMTIME pTime;

		GetLocalTime( &pTime );
		GetDateFormat( LOCALE_USER_DEFAULT, 0, &pTime, L"yyyy-MM-dd", strDate.GetBuffer( 64 ), 64 );
		GetTimeFormat( LOCALE_USER_DEFAULT, 0, &pTime, L"hh:mm tt", strTime.GetBuffer( 64 ), 64 );
		strDate.ReleaseBuffer(); strTime.ReleaseBuffer();

		CXMLElement* pOuter = pFolder->m_pSchema->Instantiate();
		CXMLElement* pInner = pOuter->AddElement( L"searchFolder" );
		pInner->AddAttribute( L"title", pFolder->m_sName );
		pInner->AddAttribute( L"content", pSearch->m_sSearch );
		pInner->AddAttribute( L"date", strDate );
		pInner->AddAttribute( L"time", strTime );
		pFolder->SetMetadata( pOuter );
		delete pOuter;
	}

	if ( CFileList* pFiles = Library.Search( pSearch, 0, TRUE ) )
	{
		for ( POSITION pos = pFiles->GetHeadPosition(); pos; )
		{
			const CLibraryFile* pFile = pFiles->GetNext( pos );

			if ( Settings.Search.SchemaTypes && pSearch->m_pSchema != NULL )
			{
				if ( ! pSearch->m_pSchema->FilterType( pFile->m_sName ) )
					pFile = NULL;
			}

			if ( pFile != NULL && pFile->IsAvailable() )
				pFolder->AddFile( const_cast< CLibraryFile* >( pFile ) );
		}

		delete pFiles;
	}

	oLock.Unlock();

	Update();
	Display( pFolder );
	GetParent()->PostMessage( WM_COMMAND, ID_VIEW_LIBRARY );
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:88,代码来源:CtrlLibraryFrame.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTimeInMillis函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTile函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap