how to use printf with microseconds c 2b 2b

Solutions on MaxInterview for how to use printf with microseconds c 2b 2b by the best coders in the world

showing results for - "how to use printf with microseconds c 2b 2b"
Alberto
31 Nov 2020
1 {
2   printf("%s", std::to_string(d).c_str() );
3 }
4
Loretta
01 Jan 2017
1template<typename Rep, typename Ratio>
2printf_dur( std::chrono::duration< Rep, Ratio > dur )
3{
4    printf( "%lld ticks of %lld/%lld == %.3fs",
5            (long long int) dur.count(),
6            (long long int) Ratio::num,
7            (long long int) Ratio::den,
8            ( (Ratio::num == 1LL)
9              ? (float) dur.count() / (float) Ratio::den
10              : (float) dur.count() * (float) Ratio::num
11            )
12         );
13}
14
Roberta
12 May 2019
1printf("%lld", static_cast<long long int> (d));
2