Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
be4c75a7
Commit
be4c75a7
authored
May 14, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Use gmtime_r instead of gmtime
parent
7b9a8acc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/util.cc
src/util.cc
+8
-3
No files found.
src/util.cc
View file @
be4c75a7
...
@@ -138,9 +138,14 @@ std::string percentDecode
...
@@ -138,9 +138,14 @@ std::string percentDecode
std
::
string
http_date
(
time_t
t
)
std
::
string
http_date
(
time_t
t
)
{
{
char
buf
[
32
];
char
buf
[
32
];
tm
*
tms
=
gmtime
(
&
t
);
// returned struct is statically allocated.
tm
tms
;
size_t
r
=
strftime
(
buf
,
sizeof
(
buf
),
"%a, %d %b %Y %H:%M:%S GMT"
,
tms
);
return
std
::
string
(
&
buf
[
0
],
&
buf
[
r
]);
if
(
gmtime_r
(
&
t
,
&
tms
)
==
nullptr
)
{
return
""
;
}
auto
rv
=
strftime
(
buf
,
sizeof
(
buf
),
"%a, %d %b %Y %H:%M:%S GMT"
,
&
tms
);
return
std
::
string
(
&
buf
[
0
],
&
buf
[
rv
]);
}
}
time_t
parse_http_date
(
const
std
::
string
&
s
)
time_t
parse_http_date
(
const
std
::
string
&
s
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment