私は窓でGetTimeZoneInformation
を使用しています...しかし、linuxで同等のものを見つけることができません。 ubuntuでGetTimeZoneInformationと同等ですか?
1
A
答えて
2
私はもう少しデバッグ時間に関連する構造の後でそれを理解しました。
struct tm * gmtime (const time_t * timer)
を使用すると、UTC時間がかかります。
tzset()
とtzname[0]
を使用してタイムゾーン情報を取得できます。
1
ブーストのタイムゾーンデータベースを含むBoost.Date_Timeです。同じものを使うことができます。
2
あなたは、Unix上で使用することができます以下ホストマシンのシステム設定に従って、現在のタイムゾーンを与える
std::string LocalTimeZone()
{
time_t now = time(NULL);
struct tm tnow = *localtime(&now);
std::string tz = tnow.tm_zone;
std::cout << "Local timezone: " << tz << std::endl;
char buff[100];
strftime(buff, sizeof buff, "%a %b %d %Y %T %Z%z", &tnow);
std::vector<std::string> vec;
const std::string s(buff);
boost::split(vec, s, boost::is_any_of(" "));
std::vector<std::string>::iterator i = vec.end();
return *--i;
}
。
関連する問題
- 1. セットと同等と同等
- 2. Androidで_vscprintfと同等ですか?
- 3. PHPでc#outputcacheと同等ですか?
- 4. MVC3でUserControlと同等ですか?
- 5. Azure AppFabricはAWSと同等ですか?
- 6. jQuery.fn.jquery jQuery Mobileと同等ですか?
- 7. なぜ(?!^)は(?<!^)と同等ですか?
- 8. javascript/node.jsのseek()と同等ですか?
- 9. iOS NSNotificationはEventsと同等ですか?
- 10. バイナリデータのreadfileと同等ですか?
- 11. アンドロイドMGBox2ライブラリと同等ですか?
- 12. イベントリスナー - Firefoxと同等ですか?
- 13. .NETデータバインディングと同等のQtですか?
- 14. WinFormのSizeToContentと同等ですか?
- 15. WP7のColorMatrixと同等ですか?
- 16. pg_query_paramsはmysqlと同等ですか?
- 17. RFTはjQuery .next()と同等ですか?
- 18. Java MAX_PATHと同等ですか?
- 19. C++のcheckstyleと同等ですか?
- 20. osxの/etc/init.dと同等ですか?
- 21. perl -peと同等のPythonですか?
- 22. gBrowserと同等のChromeですか?
- 23. Firefoxのconsole.memoryと同等ですか?
- 24. .vceと同等のオープンフォーマットですか?
- 25. SubversionはTFSシェルビングと同等ですか?
- 26. DateTimeOffset.UtcNow.DateTimeはDateTime.UtcNowと同等ですか?
- 27. PasspropsはNavigatorと同等ですか?
- 28. IzPackはNSIS ReadCustomerDataと同等ですか?
- 29. Objective-C + =同等ですか?
- 30. Javascript + =同等ですか?