📄 chk_timespec.cpp
字号:
/* Copyright is licensed under GNU LGPL. by I.J.Wang 2003 Build: make chk_time*/#include "wytimespec.h"#include "wystr.h"#include <iostream>#include <limits>#include <unistd.h>#include <sys/types.h>#if WYTIMESPEC_VERSION!=31#error Test code is for WYTIMESPEC_VERSION 31#endif#define TEST_SLEEP_TILLextern void ck_timespec(void);static const WyStr chdr( "+---------------+\n" "| main() caught:|\n" "+---------------+\n");int main(void) throw()try { std::cout << "Checking wytimespec.h ...\n"; if(std::strcmp(WyTimeSpec::class_name,"WyTimeSpec")!=0) { WY_THROW( WyRet() ); } ck_timespec(); std::cout << " WyTimeSpec::min()/max()=" << Wy::wrd(WyTimeSpec::min()).c_str() << " / " << Wy::wrd(WyTimeSpec::max()).c_str() << std::endl; WyTimeSpec tm_now(Wy::now()); std::cout << " It is now()= " << Wy::wrd(tm_now).c_str() << " seconds (UTC)\n"; std::cout << " " << Wy::wrd(tm_now, 0,3).c_str() << '\n'; std::cout << "Checked Ok\n"; return(0);}catch(const WyRet& e) { std::cerr << chdr.c_str() << Wy::wrd(e).c_str() << std::endl; return(-1);}catch(const std::exception& e) { std::cerr << chdr.c_str() << "std::exception" << std::endl; return(-1);}catch(...) { std::cerr << chdr.c_str() << "unknown unwind" << std::endl; return(-1);};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -