Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Archive
Alchemy Viewer
Commits
2539f1a2
Commit
2539f1a2
authored
9 years ago
by
Drake Arconis
Browse files
Options
Downloads
Plain Diff
Merge
parents
9f2eac8c
ac7601f3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/lldate.cpp
+38
-2
38 additions, 2 deletions
indra/llcommon/lldate.cpp
with
38 additions
and
2 deletions
indra/llcommon/lldate.cpp
+
38
−
2
View file @
2539f1a2
...
...
@@ -128,7 +128,7 @@ void LLDate::toStream(std::ostream& s) const
std
::
time_t
time
=
static_cast
<
std
::
time_t
>
(
mSecondsSinceEpoch
);
#if LL_WINDOWS
if
(
!
gmtime_s
(
&
exp_time
,
&
time
))
if
(
gmtime_s
(
&
exp_time
,
&
time
)
!=
0
)
#else
if
(
!
gmtime_r
(
&
time
,
&
exp_time
))
#endif
...
...
@@ -196,6 +196,42 @@ bool LLDate::fromString(const std::string& iso8601_date)
bool
LLDate
::
fromStream
(
std
::
istream
&
s
)
{
std
::
tm
time
=
{
0
};
int
c
;
#ifdef LL_WINDOWS // Windows has broken std::get_time() woohoo!
int32_t
tm_part
;
s
>>
tm_part
;
time
.
tm_yday
=
tm_part
-
1900
;
c
=
s
.
get
();
// skip the hypen
if
(
c
!=
'-'
)
{
return
false
;
}
s
>>
tm_part
;
time
.
tm_mon
=
tm_part
-
1
;
c
=
s
.
get
();
// skip the hypen
if
(
c
!=
'-'
)
{
return
false
;
}
s
>>
tm_part
;
time
.
tm_mday
=
tm_part
;
c
=
s
.
get
();
// skip the T
if
(
c
!=
'T'
)
{
return
false
;
}
s
>>
tm_part
;
time
.
tm_hour
=
tm_part
;
c
=
s
.
get
();
// skip the :
if
(
c
!=
':'
)
{
return
false
;
}
s
>>
tm_part
;
time
.
tm_min
=
tm_part
;
c
=
s
.
get
();
// skip the :
if
(
c
!=
':'
)
{
return
false
;
}
s
>>
tm_part
;
time
.
tm_sec
=
tm_part
;
c
=
s
.
peek
();
if
(
c
==
'.'
)
{
F64
fractional
=
0.0
;
s
>>
fractional
;
}
#else
std
::
string
this_locale
=
LLStringUtil
::
getLocale
();
if
(
this_locale
!=
sPrevLocale
)
{
...
...
@@ -210,9 +246,9 @@ bool LLDate::fromStream(std::istream& s)
{
return
false
;
}
#endif
std
::
time_t
tm
=
timegm
(
&
time
);
F64
seconds_since_epoch
=
static_cast
<
F64
>
(
tm
);
int
c
;
c
=
s
.
peek
();
// check for offset
if
(
c
==
'+'
||
c
==
'-'
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment