blob: 3b50f40c1f670ff6222693bea4aa5f567b427ab6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// { dg-options "-std=gnu++20" }
// { dg-do run { target c++20 } }
#include <chrono>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
using std::ostringstream;
using std::chrono::hh_mm_ss;
using namespace std::chrono_literals;
std::locale::global(std::locale::classic());
{
hh_mm_ss hms{-4083007ms};
ostringstream out;
out << hms;
VERIFY( out.str() == "-01:08:03.007" );
}
{
hh_mm_ss hms{4083007ms};
ostringstream out;
out << hms;
VERIFY( out.str() == "01:08:03.007" );
}
{
hh_mm_ss hms{65745123ms};
ostringstream out;
out << hms;
VERIFY( out.str() == "18:15:45.123" );
}
ostringstream out;
out << hh_mm_ss{65745s};
VERIFY( out.str() == "18:15:45" );
}
int main()
{
test01();
}
|