Last active
August 29, 2015 14:03
-
-
Save NaokiKuzumi/c7606d667495904e8703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
#include <iostream> | |
// compile with -std=c++11 option | |
int main(){ | |
typedef std::chrono::duration <int,std::ratio<24*60*60> > chomado_year; | |
std::chrono::hours seven_days(24*7); | |
std::cout << "7 days is " << std::chrono::duration_cast<chomado_year>(seven_days).count() << " years for chomado" << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 days is 7 years for chomado |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://cpplover.blogspot.jp/2012/05/c11_24.html
http://ja.cppreference.com/w/cpp/chrono/duration
を参考に初めてさわってみました。