Timeval: Restore output stream flags after changing them

Change-Id: I866505f29ed56d8f3ba3aaba70c0d82479987c64
Closes: CID#149361
This commit is contained in:
Harald Welte 2019-07-21 11:42:13 +02:00 committed by laforge
parent 6fa906c280
commit 2a3d8ba71a
1 changed files with 2 additions and 1 deletions

View File

@ -87,8 +87,9 @@ long Timeval::delta(const Timeval& other) const
ostream& operator<<(ostream& os, const Timeval& tv)
{
os.setf( ios::fixed, ios::floatfield );
ios_base::fmtflags flags_backup = os.setf( ios::fixed, ios::floatfield );
os << tv.seconds();
os.flags( flags_backup );
return os;
}