本文整理汇总了C++中TDateTime::DecodeTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TDateTime::DecodeTime方法的具体用法?C++ TDateTime::DecodeTime怎么用?C++ TDateTime::DecodeTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDateTime
的用法示例。
在下文中一共展示了TDateTime::DecodeTime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UniqTempDir
UnicodeString UniqTempDir(const UnicodeString & BaseDir, const UnicodeString & Identity,
bool Mask)
{
UnicodeString TempDir;
do
{
TempDir = BaseDir.IsEmpty() ? SystemTemporaryDirectory() : BaseDir;
TempDir = ::IncludeTrailingBackslash(TempDir) + Identity;
if (Mask)
{
TempDir += L"?????";
}
else
{
#if defined(__BORLANDC__)
TempDir += ::IncludeTrailingBackslash(FormatDateTime(L"nnzzz", Now()));
#else
TDateTime dt = Now();
uint16_t H, M, S, MS;
dt.DecodeTime(H, M, S, MS);
TempDir += ::IncludeTrailingBackslash(FORMAT(L"%02d%03d", M, MS));
#endif
}
}
while (!Mask && ::DirectoryExists(TempDir));
return TempDir;
}
示例2:
//---------------------------------------------------------------------------
static int __stdcall cb_scancom_download_da_init(void *usr_arg)
{
TScanPort *t=(TScanPort *)usr_arg;
int i = t->GetComportIndex();
MainForm->DownLoadTimeSec[i]=0;
// access
if (MainForm->Get_EnableFactoryDatabaseLog())
{
TDateTime datetime;
TDateTime date = datetime.CurrentDate();
TDateTime time = datetime.CurrentTime();
sTime stime;
time.DecodeTime( &stime.hour, &stime.min, &stime.sec, &stime.msec);
MainForm->SetDnDate( i, date );
MainForm->SetDnStartTime( i, time );
MainForm->SetDnStartsTime( i, stime );
}
t->prefix = "DA ";
t->SyncInitProgress();
t->SyncUpdateProgressColor(clWhite, clRed);
return 0;
}
示例3: addChat
void TMinosChatForm::addChat(const std::string &mess)
{
TDateTime dt = TDateTime::CurrentDateTime();
unsigned short h, m, s, ms;
dt.DecodeTime( &h, &m, &s, &ms );
String sdt = dt.FormatString( "hh:nn:ss " ) + mess.c_str();
chatQueue.push_back(sdt.c_str());
}
示例4: localToUTC
TDateTime localToUTC( TDateTime t )
{
/*
void __fastcall DecodeDate(unsigned short* year, unsigned short*
month, unsigned short* day) const;
void __fastcall DecodeTime(unsigned short* hour, unsigned short*
min, unsigned short* sec, unsigned short* msec) const;
*/
unsigned short year;
unsigned short month;
unsigned short day;
unsigned short hour;
unsigned short min;
unsigned short sec;
unsigned short msec;
t.DecodeDate( &year, &month, &day );
t.DecodeTime( &hour, &min, &sec, &msec );
bool isDst = false;
unsigned int yoffset = year - 2006; // base year for DST figures
if ( year < 2006 || yoffset >= sizeof( DSTStart ) / sizeof( int ) )
{
static dstShown = 0;
if (dstShown != calendarYear)
ShowMessage( "DST conversions only defined from 2006 until 2011!" );
dstShown = calendarYear;
return t;
}
if ( month > 3 && month < 10 )
{
isDst = true;
}
else
if ( month == 3 && day >= DSTStart[ yoffset ] )
{
isDst = true;
}
else
if ( month == 10 && day < DSTEnd[ yoffset ] )
{
isDst = true;
}
if ( isDst )
{
t -= TDateTime( 1, 0, 0, 0 );
}
return t;
}
示例5: AsStr
String TTimeLapse::AsStr(TDateTime dt)
{
if ((int)dt == 0) dt = Elapsed();
dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec);
String str;
if (FHour != 0)
str = dt.FormatString("h':'nn':'ss");
else
str = dt.FormatString("n':'ss");
return str;
}
示例6: SetCurrentDateTime
bool TDateTime::SetCurrentDateTime(TDateTime &rhs)
{
#ifndef WIN32
unsigned int year=0, month=0, day=0, hour=0, min=0, sec=0;
rhs.DecodeDate( year, month, day );
rhs.DecodeTime( hour, min, sec );
//更新操作系统时间
struct tm tmSys;
time_t tSys;
tmSys.tm_year = year - 1900;
tmSys.tm_mon = month - 1;
tmSys.tm_mday = day;
tmSys.tm_sec = sec;
tmSys.tm_min = min;
tmSys.tm_hour = hour;
tmSys.tm_isdst = -1;
if ( ( tSys = mktime( &tmSys ) ) == -1 )
{
DBG_PRN("info", ("mktime error!!"));
return false;
}
if ( stime( &tSys ) == -1)
{
DBG_PRN("info", ("stime error!!"));
return false;
}
//更RTC时间
// unsigned char tmp[3];
// int datetime;
// datetime = rhs.FormatInt(YYYYMMDD);
// int2bin(&tmp[0], (datetime / 10000) % 100, 1);
// int2bin(&tmp[1], (datetime / 100) % 100, 1);
// int2bin(&tmp[2], datetime % 100, 1);
// SetRTCData(tmp);
//
// datetime = rhs.FormatInt(HHMMSS);
// int2bin(&tmp[0], (datetime / 10000) % 100, 1);
// int2bin(&tmp[1], (datetime / 100) % 100, 1);
// int2bin(&tmp[2], datetime % 100, 1);
// SetRTCTime(tmp);
#endif
return true;
}
示例7: SetCurrentDate
bool TDateTime::SetCurrentDate(TDateTime &rhs)
{
#ifndef WIN32
unsigned int year=0, month=0, day=0, hour=0, min=0, sec=0;
rhs.DecodeDate(year, month, day);
TDateTime curDateTime = CurrentDateTime();
curDateTime.DecodeTime( hour, min, sec );
TDateTime tmpDateTime(year, month, day, hour, min, sec);
return SetCurrentDateTime(tmpDateTime);
#endif
return true;
}
示例8: AsString
String TTimeLapse::AsString(const bool ms, TDateTime dt)
{
if ((int)dt == 0)
dt = Elapsed();
dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec);
String str;
if (FHour != 0)
str = IntToStr(FHour) + " Hours, ";
str += dt.FormatString("n' Minutes, 's");
if (ms)
str += dt.FormatString("'.'z");
str += " Seconds";
return str;
}