本文整理汇总了C++中TimeStamp::getTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeStamp::getTime方法的具体用法?C++ TimeStamp::getTime怎么用?C++ TimeStamp::getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeStamp
的用法示例。
在下文中一共展示了TimeStamp::getTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TimeToFileTime
bool TimeToFileTime(TimeStamp& time, LPFILETIME pFileTime)
{
SYSTEMTIME sysTime;
time.getTime(sysTime);
// convert system time to local file time
FILETIME localTime;
if (!SystemTimeToFileTime((LPSYSTEMTIME)&sysTime, &localTime))
return false;
// convert local file time to UTC file time
if (!LocalFileTimeToFileTime(&localTime, pFileTime))
return false;
return true;
}
示例2: on_buttonBox_accepted
void DialogEditTime::on_buttonBox_accepted()
{
// workaround for missing leading zero bug: prepend a "0", if it is missing
QString tStr = ui->lineEdit->text();
QStringList helper = tStr.split(":");
if(helper.first().length() == 1){
tStr.prepend("0");
}
// end of workaround
QTime t = QTime::fromString(tStr);
qDebug() << "zeit: " << t.toString();
TimeStamp* ts =0;
if(myRun){// ignore runns with Nullpointer
if(myTimeType == TT_START){
if(myRun->getStartTimeID() == 0){ // if no TS exists, create a new one
ts = new TimeStamp(0, t, TimeStamp::E);
MainWindow::competition()->addTimeStamp(ts);
ts->setRunID(myRun->getID());
myRun->setStartTimeID(ts->getID());
}else{
ts = MainWindow::competition()->getTimeStamp(myRun->getStartTimeID());
}
}else{ // goal
if(myRun->getGoalTimeID() == 0){ // if no TS exists, create a new one
ts = new TimeStamp(0, t, TimeStamp::E);
MainWindow::competition()->addTimeStamp(ts);
ts->setRunID(myRun->getID());
myRun->setGoalTimeID(ts->getID());
}else{
ts = MainWindow::competition()->getTimeStamp(myRun->getGoalTimeID());
}
}
// if new time != old time
// compare strings, because of sub-0.01s differences, which should be ignored
if(MainWindow::convertTimeToString(ts->getTime()) != MainWindow::convertTimeToString(t)){
ts->setTime(t);
ts->setSource(TimeStamp::E);
emit timeEdited(myRun);
}
}
hide();
}