タグ付けされた質問 「time.h」

4
C ++エラー: 'clock_gettime'および 'clock_settime'への未定義の参照
私はUbuntuにかなり慣れていますが、これを機能させることができません。私の学校のコンピューターでは問題なく動作し、私が何をしていないのかわかりません。私はusr / includeを確認しましたが、time.hは問題ありません。これがコードです: #include <iostream> #include <time.h> using namespace std; int main() { timespec time1, time2; int temp; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1); //do stuff here clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2); return 0; } IDEとしてCodeBlocksを使用して、ビルドと実行も行っています。どんな助けでも素晴らしいだろう、ありがとう。
157 c++  linux  ubuntu  posix  time.h 

3
struct tmはタイムゾーン情報をデータメンバーとして保存しますか
次のC ++コードを検討してください。 #include <ctime> #include <iostream> int main() { std::time_t now = std::time(nullptr); struct tm local = *std::localtime(&now); struct tm gm = *std::gmtime(&now); char str[20]; std::strftime(str, 20, "%Z", &local); std::cout << str << std::endl; // HKT std::strftime(str, 20, "%Z", &gm); std::cout << str << std::endl; // UTC return 0; } …
8 c++  c  ctime  time.h 
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.