当前位置: 首页>>代码示例>>C++>>正文


C++ TDateTime::DecodeTime方法代码示例

本文整理汇总了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;
}
开发者ID:gumb0,项目名称:Far-NetBox,代码行数:28,代码来源:GUITools.cpp

示例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;
}
开发者ID:iamtag,项目名称:sp_mdt,代码行数:26,代码来源:TScanPort.cpp

示例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());
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:8,代码来源:MinosChatMain.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:52,代码来源:VHFList.cpp

示例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;
}
开发者ID:ChakaZulu,项目名称:ecc,代码行数:13,代码来源:eccTimeLapse.cpp

示例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;
}
开发者ID:zhangchaoyangaisino,项目名称:CJ_FWSK_MIDDLEWARE_1.0000,代码行数:49,代码来源:TDateTime.cpp

示例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;
}
开发者ID:zhangchaoyangaisino,项目名称:CJ_FWSK_MIDDLEWARE_1.0000,代码行数:15,代码来源:TDateTime.cpp

示例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;
}
开发者ID:ChakaZulu,项目名称:ecc,代码行数:16,代码来源:eccTimeLapse.cpp


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