本文整理汇总了C++中CTime::getHour方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::getHour方法的具体用法?C++ CTime::getHour怎么用?C++ CTime::getHour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTime
的用法示例。
在下文中一共展示了CTime::getHour方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onRequest
//
// On Ajax XHTML request Event
//
virtual void onRequest(const int index, CString &result) {
CTime tm;
switch(index) {
case CGI_INDEX_TEMP:
result.printf("%0.2f, %0.2f, %d, %d, %d",
sht1x.temp,
sht1x.humi,
(MAX_USER_POOL-heapAvailableSize())*100/MAX_USER_POOL, // MAX user's memory=35KB
sys.m_cpu,
sys.m_net);
break;
case SSI_INDEX_DATE:
tm = CTime::now();
result.printf("%04d/%02d/%02d",
tm.getYear(),
tm.getMonth(),
tm.getDay()
);
break;
case SSI_INDEX_TIME:
tm = CTime::now();
result.printf("%02d:%02d:%02d",
tm.getHour(),
tm.getMinute(),
tm.getSecond()
);
break;
}
}
示例2: show
// Write instance of the CTime class into the given writer.
static void show(IWriter& writer, const CTime& a_crTime)
{ CALL
writer << fill_0 << width(2) << a_crTime.getHour() << STR(':');
writer << fill_0 << width(2) << a_crTime.getMinute() << STR(':');
writer << fill_0 << width(2) << a_crTime.getSecond() << STR('-');
writer << fill_0 << width(4) << a_crTime.getMillisecond() << ln;
}
示例3: main
/* ==============================================
main task routine
============================================== */
int main(void) {
pool_memadd((uint32_t) pool, sizeof(pool));
#ifdef DEBUG
dbg.start();
#endif
// Simple demo Code (removable)
CPin led(LED1);
CTxtLcd lcd(UNO_8, UNO_9, UNO_10, UNO_0, UNO_1, UNO_2, UNO_3, UNO_4, UNO_5, UNO_6, UNO_7);
lcd.begin();
// lcd.cursor();
// lcd.blink();
Console con(lcd);
con << "Hello World" << endl;
CTick to;
CTime tm;
// Enter an endless loop
while (1) {
// Simple demo Code (removable)
led = !led;
sleep(200);
if ( to.isExpired(1000) ) {
to.reset();
tm = CTime::now();
lcd.setCursor(0,1);
con.printf("%02d/%02d %02d:%02d:%02d",
tm.getMonth(),
tm.getDay(),
tm.getHour(),
tm.getMinute(),
tm.getSecond()
);
}
}
return 0;
}
示例4: main
/* ==============================================
main task routine
============================================== */
int main(void) {
pool_memadd((uint32_t) pool, sizeof(pool));
#ifdef DEBUG
dbg.start();
#endif
// Simple demo Code (removable)
CPin led(LED1);
//
// Add WebSocket Server with service 'sslm-k-056b'
//
MyWebSocketServer server;
server.add("/sslm-k-056b", WSS_INDEX_SSLM);
//
// set reversion LED module index
//
sslm.setting(2, sslmREVERSE);
sslm.setting(4, sslmREVERSE);
sslm.start();
//
// set default LED brightness
//
sslm.brightness(0.5); // brightness=50%
// LED Test
for (int v=0; v<16; v++) {
for (int i=0; i<6; i++) {
sslm.write(i, v);
sslm.dot(i, (v & 0x01)? true: false);
}
sslm.trigger();
sleep(500);
}
sslm.clear();
CTime tm;
int v0, v1, v2;
gnShowType = SHOW_FOR_TIME;
gnHourType = SHOW_HOUR_24;
// set dots : for time display
sslm.dot(1, true);
sslm.dot(2, true);
sslm.dot(3, true);
sslm.dot(4, true);
// Enter an endless loop
while (1) {
// Simple demo Code (removable)
led = !led;
sleep(500);
// update time
tm = CTime::now(); // get system date/time
if ( gnShowType==SHOW_FOR_TIME ) {
// blink decimal point for Time Format
if ( led ) {
sslm.dot(1, true);
sslm.dot(2, true);
sslm.dot(3, true);
sslm.dot(4, true);
} else {
sslm.dot(1, false);
sslm.dot(2, false);
sslm.dot(3, false);
sslm.dot(4, false);
}
v0 = tm.getHour();
if ( gnHourType==SHOW_HOUR_12 ) {
if ( v0>12 ) v0 -=12;
}
v1 = tm.getMinute();
v2 = tm.getSecond();
} else {
//
// Show Date Info
//
v0 = tm.getYear() % 100;
v1 = tm.getMonth();
v2 = tm.getDay();
}
// update sslm
sslm.write(5, v2 % 10);
sslm.write(4, v2 / 10);
sslm.write(3, v1 % 10);
sslm.write(2, v1 / 10);
sslm.write(1, v0 % 10);
sslm.write(0, v0 / 10);
//.........这里部分代码省略.........