本文整理汇总了C++中GetDateFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDateFormat函数的具体用法?C++ GetDateFormat怎么用?C++ GetDateFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDateFormat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SaveSessionDate
int SaveSessionDate()
{
if (session_list[0] != 0) {
int TimeSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, NULL, 0);
TCHAR *szTimeBuf = (TCHAR*)mir_alloc((TimeSize + 1)*sizeof(TCHAR));
GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, szTimeBuf, TimeSize);
int DateSize = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0);
TCHAR *szDateBuf = (TCHAR*)mir_alloc((DateSize + 1)*sizeof(TCHAR));
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szDateBuf, DateSize);
int lenn = (DateSize + TimeSize + 5);
TCHAR *szSessionTime = (TCHAR*)mir_alloc(lenn*sizeof(TCHAR));
mir_sntprintf(szSessionTime, lenn, _T("%s - %s"), szTimeBuf, szDateBuf);
char szSetting[256];
mir_snprintf(szSetting, "%s_%d", "SessionDate", 0);
TCHAR *ptszSaveSessionDate = db_get_tsa(NULL, MODNAME, szSetting);
db_set_ts(NULL, MODNAME, szSetting, szSessionTime);
mir_free(szSessionTime);
if (ptszSaveSessionDate)
ResaveSettings("SessionDate", 1, g_ses_limit, ptszSaveSessionDate);
if (szTimeBuf)
mir_free(szTimeBuf);
if (szDateBuf)
mir_free(szDateBuf);
}
if (g_bCrashRecovery)
db_set_b(NULL, MODNAME, "lastSaveCompleted", 1);
return 0;
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:35,代码来源:Main.cpp
示例2: MAKELCID
void CGitPropertyPage::Time64ToTimeString(__time64_t time, TCHAR * buf, size_t buflen) const
{
struct tm newtime;
SYSTEMTIME systime;
LCID locale = LOCALE_USER_DEFAULT;
if (!CRegDWORD(_T("Software\\TortoiseGit\\UseSystemLocaleForDates"), TRUE))
locale = MAKELCID((WORD)CRegStdDWORD(_T("Software\\TortoiseGit\\LanguageID"), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)), SORT_DEFAULT);
*buf = '\0';
if (time)
{
TCHAR timebuf[MAX_STRING_LENGTH] = { 0 };
TCHAR datebuf[MAX_STRING_LENGTH] = { 0 };
_localtime64_s(&newtime, &time);
systime.wDay = (WORD)newtime.tm_mday;
systime.wDayOfWeek = (WORD)newtime.tm_wday;
systime.wHour = (WORD)newtime.tm_hour;
systime.wMilliseconds = 0;
systime.wMinute = (WORD)newtime.tm_min;
systime.wMonth = (WORD)newtime.tm_mon+1;
systime.wSecond = (WORD)newtime.tm_sec;
systime.wYear = (WORD)newtime.tm_year+1900;
if (CRegStdDWORD(_T("Software\\TortoiseGit\\LogDateFormat")) == 1)
GetDateFormat(locale, DATE_SHORTDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH);
else
GetDateFormat(locale, DATE_LONGDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH);
GetTimeFormat(locale, 0, &systime, NULL, timebuf, MAX_STRING_LENGTH);
*buf = '\0';
_tcsncat_s(buf, buflen, datebuf, MAX_STRING_LENGTH-1);
_tcsncat_s(buf, buflen, _T(" "), MAX_STRING_LENGTH-1);
_tcsncat_s(buf, buflen, timebuf, MAX_STRING_LENGTH-1);
}
}
开发者ID:545546460,项目名称:TortoiseGit,代码行数:35,代码来源:GITPropertyPage.cpp
示例3: ChangeTip
void ChangeTip(NOTIFYICONDATA* nid, SYSTEMTIME* time) {
TCHAR *buf, *datef = _T("dddd yyyy.MM.dd");
HANDLE heap = GetProcessHeap();
size_t n;
n = GetDateFormat(LOCALE_USER_DEFAULT, 0, time, datef, NULL, 0);
buf = (TCHAR*)HeapAlloc(heap, HEAP_ZERO_MEMORY, n * sizeof(TCHAR));
GetDateFormat(LOCALE_USER_DEFAULT, 0, time, datef, buf, n);
_stprintf_s(nid->szTip, 64, _T("%s %02d:%02d"), buf, time->wHour, time->wMinute);
HeapFree(heap, 0, buf);
}
开发者ID:alexmarsev,项目名称:traybin,代码行数:11,代码来源:traybin.cpp
示例4: parseLastSeenDate
static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
MCONTACT hContact = NULL;
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.tszContact = ai->targv[1];
ci.flags = 0xFFFFFFFF ^ (CI_TCHAR == 0 ? CI_UNICODE : 0);
int count = getContactFromString(&ci);
if (count == 1 && ci.hContacts != NULL) {
hContact = ci.hContacts[0];
mir_free(ci.hContacts);
}
else {
mir_free(ci.hContacts);
return NULL;
}
TCHAR *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
SYSTEMTIME lsTime = { 0 };
char *szModule = SEEN_MODULE;
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
if (lsTime.wYear == 0)
return NULL;
lsTime.wMilliseconds = 0;
lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0);
lsTime.wMinute = db_get_w(hContact, szModule, "Minutes", 0);
lsTime.wHour = db_get_w(hContact, szModule, "Hours", 0);
lsTime.wDay = db_get_w(hContact, szModule, "Day", 0);
lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0);
lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
mir_free(res);
return NULL;
}
return res;
}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:52,代码来源:parse_miranda.cpp
示例5: CDialog
ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pParent /*=NULL*/)
: CDialog(ExportGSASnapshot::IDD, pParent)
{
//{{AFX_DATA_INIT(ExportGSASnapshot)
m_desc = _T("");
m_notes = _T("");
m_title = _T("");
//}}AFX_DATA_INIT
m_title = title;
m_filename = filename;
char date[100];
char time[100];
GetDateFormat(LOCALE_USER_DEFAULT,
DATE_SHORTDATE,
NULL,
NULL,
date,
100);
GetTimeFormat(LOCALE_USER_DEFAULT,
0,
NULL,
NULL,
time,
100);
m_desc.Format("%s %s", date, time);
}
开发者ID:Brukwa,项目名称:VisualBoyAdvance,代码行数:27,代码来源:ExportGSASnapshot.cpp
示例6: formatDate
wstring formatDate(StringBuffer& date) {
wstring dd(TEXT(""));
wchar_t* wdate = toWideChar(date);
if (wdate == NULL) {
return dd;
}
wchar_t data[80];
wchar_t formatDate[80];
int found = 0;
SYSTEMTIME timeDest;
swscanf_s(wdate, L"%4d%2d%2d", &timeDest.wYear, &timeDest.wMonth, &timeDest.wDay);
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, data, 80);
dd = data;
if ((found = dd.find(TEXT("dddd, "))) != wstring::npos) {
dd.replace(found, 6, TEXT(""));
} else if ((found = dd.find(TEXT("dddd,"))) != wstring::npos) {
dd.replace(found, 5, TEXT(""));
}else if ((found = dd.find(TEXT("dddd"))) != wstring::npos) {
dd.replace(found, 4, TEXT(""));
}
trim(dd);
GetDateFormat(LOCALE_USER_DEFAULT, NULL, &timeDest, dd.c_str(), formatDate, 80);
dd = formatDate;
return dd;
}
开发者ID:funambol-mirror,项目名称:funambol-windows-client,代码行数:29,代码来源:ClientUtil.cpp
示例7: edfheader_to_physical
void edfheader_to_physical(EDFHEADERStruct * from, EDFHEADER_PHYSICALStruct * to)
{
int len,t;
char * ch;
SYSTEMTIME st;
char actdate[10];
char acttime[10];
len=256+256*from->channels;
ch=(char *)to;
for(t=0;t<256;t++,ch++) *ch=' ';
GetSystemTime(&st); // gets current time
GetDateFormat(0, 0, &st, "dd.MM.yy" , actdate, 9);actdate[8]=0;
GetTimeFormat(0, 0, &st, "HH.mm.ss" , acttime, 9);acttime[8]=0;
strcpy(to->startdate,actdate);
strcpy(to->starttime,acttime);
strcpy(to->version,"0");
strcpy(to->patient,from->patient);
strcpy(to->recording,from->device);
sprintf(to->records,"%d",from->segments);
sprintf(to->duration,"%d",1);
sprintf(to->channels,"%d",from->channels);
sprintf(to->headerlength,"%d",len);
ch=(char *)to;
for(t=0;t<256;t++,ch++) if (*ch==0) *ch=' ';
to->end=0;
}
开发者ID:Smeetal,项目名称:BrainBay,代码行数:33,代码来源:files.cpp
示例8: CallContextDayNote
BOOL CallContextDayNote(SYSTEMTIME Time, HWND hCalendar)
{
CStringArray arr;
arr.Add(_l("New reminder"));
arr.Add(_l("Add date to clipboard"));
int iSelection=SelectFromMenu(arr,0);
if(iSelection<0){
return 0;
}
if(iSelection==0){
return -1;
}
CString s="";
COleDateTime tm;//=COleDateTime(Time);
tm.SetDate(Time.wYear,Time.wMonth,Time.wDay);
if(strlen(szDateFormat)==0){
s=DateFormat(tm,FALSE);
}else{
SYSTEMTIME EventTime;
tm.GetAsSystemTime(EventTime);
char szTmp[1020]={0};
GetDateFormat(LOCALE_USER_DEFAULT,0,&EventTime,szDateFormat,szTmp,sizeof(szTmp));
s=szTmp;
}
BOOL bThroughGlobal=0;
USES_CONVERSION;
SetClipboardText(A2W(s),bThroughGlobal,0);
return 0;
};
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:29,代码来源:WKPlugin.cpp
示例9: GetTime
//////////////////////////////////////////////////////////////////////
// Methode : GetTime
// Resume : Return Time cache entry
// In : FILETIME ft : the cache entry
// Out : CString Time of the cache entry
//////////////////////////////////////////////////////////////////////
CString GetTime(FILETIME ft)
{
SYSTEMTIME st;
char szLocalDate[255];
char szLocalTime[255];
CString strtemp;
FileTimeToLocalFileTime( &ft, &ft );
FileTimeToSystemTime( &ft, &st );
GetDateFormat( LOCALE_USER_DEFAULT,
DATE_SHORTDATE,
&st,
NULL,
szLocalDate,
255 );
GetTimeFormat( LOCALE_USER_DEFAULT,
0,
&st,
NULL,
szLocalTime,
255 );
strtemp = szLocalDate;
strtemp += " | ";
strtemp += szLocalTime ;
return (strtemp);
}
开发者ID:pierrecoll,项目名称:urlcache,代码行数:37,代码来源:DisplayCache.cpp
示例10: os_ctimeW_r
/** \brief Translate calendar time into readable string representation
*
* Possible Results:
* - returns buf if buf != NULL
* - returns NULL if buf == NULL
*/
os_size_t
os_ctimeW_r(
os_timeW *t,
char *buf,
os_size_t bufsz)
{
os_size_t result = 0;
SYSTEMTIME systemTime;
FILETIME systemTimeSince1601;
DWORD64 dw64Time;
DWORD64 dw64MAXDWORD = MAXDWORD;
wchar_t format[32];
char *fstr;
/* Using win32 ctime here */
if (buf)
{
int iSizeOfBuffer;
dw64Time = (t->wt)/100;
systemTimeSince1601.dwHighDateTime = (dw64Time / (dw64MAXDWORD+1));
systemTimeSince1601.dwLowDateTime = (dw64Time % (dw64MAXDWORD+1));
FileTimeToSystemTime(&systemTimeSince1601, &systemTime);
/* Time is in UTC here */
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &systemTime, L"yyyy'-'MM'-'dd'T'HH':'mm':'ss", format, 32);
/* convert wide str to multi byte str */
fstr = wce_wctomb(format);
result = snprintf(buf, bufsz, "%s", fstr);
os_free(fstr);
}
return result;
}
开发者ID:osrf,项目名称:opensplice,代码行数:41,代码来源:os_time.c
示例11: GetDateFormat
//**************************************************************************************************
b8 A2Date::ToStr(s8 *str)
{
if (!*(s32*)&date) return 0;
#ifdef _WIN32
SYSTEMTIME time;
time.wYear = date.y;
time.wMonth = date.m;
time.wDayOfWeek = 0;
time.wDay = date.d;
time.wHour = 0;
time.wMinute = 0;
time.wSecond = 0;
time.wMilliseconds = 0;
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, str, -1);
#else
// sprintf(str, "%i.%i.%i", date.y, date.m, date.d);
// sprintf(str, "%i.%i.%i", date.d, date.m, date.y % 100);
sprintf(str, "%i/%i/%i", date.m, date.d, date.y % 100);
#endif
return 1;
}
开发者ID:shysaur,项目名称:ChiptuneMDImporter,代码行数:26,代码来源:A2Date.cpp
示例12: data_get_modified_string
/*
* data_get_modified_string - 更新日時文字列を取得
*/
BOOL data_get_modified_string(const DATA_INFO *di, TCHAR *ret)
{
SYSTEMTIME sys_time;
TCHAR str_day[BUF_SIZE], str_time[BUF_SIZE];
TCHAR *p;
if (di->type != TYPE_ITEM ||
(di->modified.dwLowDateTime == 0 && di->modified.dwHighDateTime == 0)) {
*ret = TEXT('\0');
return FALSE;
}
// ファイルタイムをシステムタイムに変換
if (FileTimeToSystemTime(&di->modified, &sys_time) == FALSE) {
*ret = TEXT('\0');
return FALSE;
}
// 日付文字列の取得
p = option.data_date_format;
if (p == NULL || *p == TEXT('\0')) {
p = NULL;
}
GetDateFormat(0, 0, &sys_time, p, str_day, BUF_SIZE - 1);
// 時間文字列の取得
p = option.data_time_format;
if (p == NULL || *p == TEXT('\0')) {
p = NULL;
}
GetTimeFormat(0, 0, &sys_time, p, str_time, BUF_SIZE - 1);
wsprintf(ret, TEXT("%s %s"), str_day, str_time);
return TRUE;
}
开发者ID:tobynet,项目名称:clcl,代码行数:35,代码来源:Data.c
示例13: FiletimeAsString
CString FiletimeAsString(FILETIME filetime)
{
SYSTEMTIME sysTime;
if(0 == FileTimeToSystemTime(&filetime,&sysTime))
return _T("");
SYSTEMTIME localTime;
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
if (!SystemTimeToTzSpecificLocalTime(&tzi, &sysTime, &localTime))
return _T("");
CString sDate;
TCHAR szDateBuffer[20] = {0};
TCHAR szTimeBuffer[20] = {0};
if (0 == GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &localTime, NULL, szDateBuffer, 20) ||
0 == GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localTime, NULL, szTimeBuffer, 20))
return _T("");
sDate.Format(_T("%s %s"), szDateBuffer, szTimeBuffer);
if(-1 != sDate.Find(_T("1601")))
return _T("");
return sDate;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:29,代码来源:COMDispatchHelper.cpp
示例14: MonthNameGenitiveToNumber
// Converts locale-specific month name to month number
// Only converts genitives
static WORD MonthNameGenitiveToNumber(LPCTSTR szStr, int * piMonthNameLength)
{
SYSTEMTIME stTemp = {0};
TCHAR szMonthName[80];
int nLength;
// Prepare the temporary SYSTEMTIME structure
// Note: The recommended way to get month name as genitive is to use GetDateFormat
// with "ddMMMM" and compare month name starting at second position
stTemp.wDay = 1;
stTemp.wYear = 2000;
// Go through all month names.
for(stTemp.wMonth = 1; stTemp.wMonth <= 13; stTemp.wMonth++)
{
// Get genitive of month name
nLength = GetDateFormat(LOCALE_USER_DEFAULT, 0, &stTemp, _T("ddMMMM"), szMonthName, _maxchars(szMonthName));
if(nLength < 3)
break;
// Compare the month name
if(!_tcsnicmp(szStr, &szMonthName[2], nLength - 3))
{
*piMonthNameLength = (nLength - 3);
return stTemp.wMonth;
}
}
// Month name genitive not recognized
return 0xFFFF;
}
开发者ID:VlaBst6,项目名称:FileTest,代码行数:33,代码来源:DateTime.cpp
示例15: BMT_GetBackupFileTime
// Gets the timestamp on the current backup file
std::wstring
BMT_GetBackupFileTime (void)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFileBackup = FindFirstFile (std::wstring (bmt::XML::install_path + L"..\\..\\BMGame\\Config\\BmSystemSettings.bmt").c_str (), &FindFileData);
FindClose (hFileBackup);
FILETIME ftModified;
FileTimeToLocalFileTime (&FindFileData.ftLastWriteTime, &ftModified);
SYSTEMTIME stModified;
FileTimeToSystemTime (&ftModified, &stModified);
wchar_t wszFileTime [512];
GetDateFormat (LOCALE_CUSTOM_UI_DEFAULT, DATE_AUTOLAYOUT, &stModified, NULL, wszFileTime, 512);
std::wstring date_time = wszFileTime;
GetTimeFormat (LOCALE_CUSTOM_UI_DEFAULT, TIME_NOSECONDS, &stModified, NULL, wszFileTime, 512);
date_time += L" ";
date_time += wszFileTime;
return date_time;
}
开发者ID:Kaldaien,项目名称:BMT,代码行数:29,代码来源:utility.cpp
示例16: BMT_GetConfigFileTime
// Gets the timestamp on the current config file
std::wstring
BMT_GetConfigFileTime (void)
{
//
// XXX: It's possible that one file is newer than another, but for now let's
// assume SystemSettings.ini is always the newest and then see how
// much trouble that assumption gets us into down the line ;)
//
WIN32_FIND_DATA FindFileData;
HANDLE hFileBackup = FindFirstFile (std::wstring (bmt::XML::install_path + L"..\\..\\BMGame\\Config\\BmSystemSettings.ini").c_str (), &FindFileData);
FILETIME ftModified;
FileTimeToLocalFileTime (&FindFileData.ftLastWriteTime, &ftModified);
SYSTEMTIME stModified;
FileTimeToSystemTime (&ftModified, &stModified);
FindClose (hFileBackup);
wchar_t wszFileTime [512];
GetDateFormat (LOCALE_CUSTOM_UI_DEFAULT, DATE_AUTOLAYOUT, &stModified, NULL, wszFileTime, 512);
std::wstring date_time = wszFileTime;
GetTimeFormat (LOCALE_CUSTOM_UI_DEFAULT, TIME_NOSECONDS, &stModified, NULL, wszFileTime, 512);
date_time += L" ";
date_time += wszFileTime;
return date_time;
}
开发者ID:Kaldaien,项目名称:BMT,代码行数:34,代码来源:utility.cpp
示例17: StrGetDateTime
uni_char* StrGetDateTime ( CONST SYSTEMTIME *pSystemTime, uni_char* szResult, int maxlen, BOOL fSec)
{
if( szResult && maxlen>=1)
{
*szResult = 0;
if( pSystemTime)
{
int lenDate = GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, pSystemTime, NULL, szResult, maxlen)-1;
if( lenDate>0)
{
int lenRemaining = maxlen - lenDate;
if( lenRemaining > 2)
{
szResult[lenDate] = ' ';
szResult[lenDate+1] = 0;
-- lenRemaining;
++ lenDate;
#ifdef _DEBUG
int lenTime =
#endif
GetTimeFormat( LOCALE_USER_DEFAULT, (fSec ? 0 : TIME_NOSECONDS), pSystemTime, NULL, szResult+lenDate, lenRemaining);
OP_ASSERT(lenTime>0);
}
}
}
}
return szResult;
}
开发者ID:prestocore,项目名称:browser,代码行数:28,代码来源:win_handy.cpp
示例18: DisplayDate
static void DisplayDate(void)
{
if ( QueryFirstContact() )
{
int First;
int Second;
/* determine if month or day is displayed first */
if ( GetDateFormat() == MONTH_FIRST )
{
First = GetRTCMON();
Second = GetRTCDAY();
}
else
{
First = GetRTCDAY();
Second = GetRTCMON();
}
if ( GetTimeFormat() == TWELVE_HOUR )
{
DisplayDayMonth(First, Second, 20);
}
else
{
int year = GetRTCYEAR();
DisplayDayMonth(First, Second, 10);
/* Write the year */
DisplayYear(year, 20, 8);
}
}
}
开发者ID:kiapper,项目名称:Watch,代码行数:32,代码来源:IdlePageMain.c
示例19: memcpy
void CServer::ShowStatus(_int64 eventDate, LPCTSTR msg, int nType)
{
USES_CONVERSION;
TIME_ZONE_INFORMATION tzInfo;
BOOL res=GetTimeZoneInformation(&tzInfo);
_int64 offset = tzInfo.Bias+((res==TIME_ZONE_ID_DAYLIGHT)?tzInfo.DaylightBias:tzInfo.StandardBias);
offset*=60*10000000;
eventDate-=offset;
LPCSTR str=T2CA(msg);
char *pBuffer=new char[strlen(str) + 1 + 8];
*pBuffer=nType;
memcpy(pBuffer + 1, &eventDate, 8);
memcpy(pBuffer + 1 + 8, str, strlen(str));
if (m_pAdminInterface)
m_pAdminInterface->SendCommand(2, 4, pBuffer, strlen(str) + 1 + 8);
delete [] pBuffer;
//Log string
if (m_pFileLogger)
{
FILETIME fFileTime;
SYSTEMTIME sFileTime;
fFileTime.dwHighDateTime = (DWORD)(eventDate>>32);
fFileTime.dwLowDateTime = (DWORD)(eventDate %0xFFFFFFFF);
FileTimeToSystemTime(&fFileTime, &sFileTime);
char text[80];
if (!GetDateFormat(
LOCALE_USER_DEFAULT, // locale for which date is to be formatted
DATE_SHORTDATE, // flags specifying function options
&sFileTime, // date to be formatted
0, // date format string
text, // buffer for storing formatted string
80 // size of buffer
))
return;
CStdString text2=" ";
text2+=text;
if (!GetTimeFormat(
LOCALE_USER_DEFAULT, // locale for which date is to be formatted
TIME_FORCE24HOURFORMAT, // flags specifying function options
&sFileTime, // date to be formatted
0, // date format string
text, // buffer for storing formatted string
80 // size of buffer
))
return;
text2+=" ";
text2+=text;
CStdString str = msg;
int pos=str.Find("-");
if (pos!=-1)
{
str.Insert(pos, text2 + " ");
}
m_pFileLogger->Log(str);
}
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:60,代码来源:Server.cpp
示例20: dateHeader
char const* dateHeader() {
static char buf[200];
#if !defined(_WIN32_WCE)
time_t tt = time(NULL);
strftime(buf, sizeof buf, "Date: %a, %b %d %Y %H:%M:%S GMT\r\n", gmtime(&tt));
#else
// WinCE apparently doesn't have "time()", "strftime()", or "gmtime()",
// so generate the "Date:" header a different, WinCE-specific way.
// (Thanks to Pierre l'Hussiez for this code)
// RSF: But where is the "Date: " string? This code doesn't look quite right...
SYSTEMTIME SystemTime;
GetSystemTime(&SystemTime);
WCHAR dateFormat[] = L"ddd, MMM dd yyyy";
WCHAR timeFormat[] = L"HH:mm:ss GMT\r\n";
WCHAR inBuf[200];
DWORD locale = LOCALE_NEUTRAL;
int ret = GetDateFormat(locale, 0, &SystemTime,
(LPTSTR)dateFormat, (LPTSTR)inBuf, sizeof inBuf);
inBuf[ret - 1] = ' ';
ret = GetTimeFormat(locale, 0, &SystemTime,
(LPTSTR)timeFormat,
(LPTSTR)inBuf + ret, (sizeof inBuf) - ret);
wcstombs(buf, inBuf, wcslen(inBuf));
#endif
return buf;
}
开发者ID:f3zz3h,项目名称:Embedded-Systems-Development,代码行数:27,代码来源:RTSPCommon.cpp
注:本文中的GetDateFormat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论