[cpp-sp] branch main updated: Switch to C routines for time parsing.

Scott Cantor cantor.2 at osu.edu
Wed Oct 22 19:29:04 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=46ec1e16d144c27922d3d140f761e2733f6209a6

The following commit(s) were added to refs/heads/main by this push:
     new 46ec1e16 Switch to C routines for time parsing.
46ec1e16 is described below

commit 46ec1e16d144c27922d3d140f761e2733f6209a6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Oct 22 15:28:59 2025 -0400

    Switch to C routines for time parsing.
---
 shibsp/util/Misc.cpp | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/shibsp/util/Misc.cpp b/shibsp/util/Misc.cpp
index f94eba2d..fdd23614 100644
--- a/shibsp/util/Misc.cpp
+++ b/shibsp/util/Misc.cpp
@@ -22,7 +22,7 @@
 #include "util/Date.h"
 #include "util/Misc.h"
 
-#include <iomanip>
+#include <ctime>
 #include <set>
 #include <sstream>
 #include <vector>
@@ -114,14 +114,9 @@ time_t shibsp::parseISODuration(const string& s)
 
 time_t shibsp::parseISODateTime(const string& s)
 {
-    if (s.empty() || s.back() != 'Z') {
-        return -1;
-    }
-    
     tm tmStruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
-    istringstream in(s);
-    in >> get_time(&tmStruct, "%Y-%m-%dT%T");
-    if (!in) {
+    char* ret = strptime(s.c_str(), "%Y-%m-%dT%TZ", &tmStruct);
+    if (!ret || *ret) {
         return -1;
     }
     return timegm(&tmStruct);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list