Last active
November 25, 2018 10:17
-
-
Save ppLorins/c16331a8119504b491077158ed26957c to your computer and use it in GitHub Desktop.
A std::chrono::nanoseconds issue found under MSVC.
This file contains hidden or 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 <stdio> | |
#include <chrono> | |
/* Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86 */ | |
int main(int argc, char** argv) | |
{ | |
//auto _nano = std::chrono::nanoseconds(3 * 1000 * 1000 * 1000); //wrong | |
auto _nano = std::chrono::duration<uint32_t, std::ratio<1, 1000000000>>(3 * 1000 * 1000 * 1000); //right | |
std::cout << _nano.count() << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment