From 2a3d8ba71ac343a9eb72c9906d923050b93957ef Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 21 Jul 2019 11:42:13 +0200 Subject: [PATCH] Timeval: Restore output stream flags after changing them Change-Id: I866505f29ed56d8f3ba3aaba70c0d82479987c64 Closes: CID#149361 --- CommonLibs/Timeval.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CommonLibs/Timeval.cpp b/CommonLibs/Timeval.cpp index fd1bcda7..420dd047 100644 --- a/CommonLibs/Timeval.cpp +++ b/CommonLibs/Timeval.cpp @@ -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; }