Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
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
fmt
Commits
04111dd1
Unverified
Commit
04111dd1
authored
Dec 24, 2021
by
Vladislav Shchapov
Committed by
GitHub
Dec 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue #2670 (#2671)
parent
817788fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
include/fmt/chrono.h
include/fmt/chrono.h
+16
-11
No files found.
include/fmt/chrono.h
View file @
04111dd1
...
@@ -1076,34 +1076,41 @@ template <typename OutputIt, typename Char> class tm_writer {
...
@@ -1076,34 +1076,41 @@ template <typename OutputIt, typename Char> class tm_writer {
write2
(
static_cast
<
int
>
(
offset
/
60
));
write2
(
static_cast
<
int
>
(
offset
/
60
));
write2
(
static_cast
<
int
>
(
offset
%
60
));
write2
(
static_cast
<
int
>
(
offset
%
60
));
}
}
void
format_utc_offset_impl
(
std
::
true_type
)
{
template
<
typename
T
,
FMT_ENABLE_IF
(
has_member_data_tm_gmtoff
<
T
>
::
value
)
>
write_utc_offset
(
tm_
.
tm_gmtoff
);
void
format_utc_offset_impl
(
const
T
&
tm
)
{
write_utc_offset
(
tm
.
tm_gmtoff
);
}
}
void
format_utc_offset_impl
(
std
::
false_type
)
{
template
<
typename
T
,
FMT_ENABLE_IF
(
!
has_member_data_tm_gmtoff
<
T
>
::
value
)
>
void
format_utc_offset_impl
(
const
T
&
tm
)
{
#if defined(_WIN32)
#if defined(_WIN32)
# if FMT_USE_TZSET
# if FMT_USE_TZSET
tzset_once
();
tzset_once
();
# endif
# endif
long
offset
=
0
;
long
offset
=
0
;
_get_timezone
(
&
offset
);
_get_timezone
(
&
offset
);
if
(
tm
_
.
tm_isdst
)
{
if
(
tm
.
tm_isdst
)
{
long
dstbias
=
0
;
long
dstbias
=
0
;
_get_dstbias
(
&
dstbias
);
_get_dstbias
(
&
dstbias
);
offset
+=
dstbias
;
offset
+=
dstbias
;
}
}
write_utc_offset
(
-
offset
);
write_utc_offset
(
-
offset
);
#else
#else
ignore_unused
(
tm
);
format_localized
(
'z'
);
format_localized
(
'z'
);
#endif
#endif
}
}
void
format_tz_name_impl
(
std
::
true_type
)
{
template
<
typename
T
,
FMT_ENABLE_IF
(
has_member_data_tm_zone
<
T
>
::
value
)
>
void
format_tz_name_impl
(
const
T
&
tm
)
{
if
(
is_classic_
)
if
(
is_classic_
)
out_
=
write_tm_str
<
Char
>
(
out_
,
tm
_
.
tm_zone
,
loc_
);
out_
=
write_tm_str
<
Char
>
(
out_
,
tm
.
tm_zone
,
loc_
);
else
else
format_localized
(
'Z'
);
format_localized
(
'Z'
);
}
}
void
format_tz_name_impl
(
std
::
false_type
)
{
format_localized
(
'Z'
);
}
template
<
typename
T
,
FMT_ENABLE_IF
(
!
has_member_data_tm_zone
<
T
>
::
value
)
>
void
format_tz_name_impl
(
const
T
&
)
{
format_localized
(
'Z'
);
}
void
format_localized
(
char
format
,
char
modifier
=
0
)
{
void
format_localized
(
char
format
,
char
modifier
=
0
)
{
out_
=
write
<
Char
>
(
out_
,
tm_
,
loc_
,
format
,
modifier
);
out_
=
write
<
Char
>
(
out_
,
tm_
,
loc_
,
format
,
modifier
);
...
@@ -1211,10 +1218,8 @@ template <typename OutputIt, typename Char> class tm_writer {
...
@@ -1211,10 +1218,8 @@ template <typename OutputIt, typename Char> class tm_writer {
out_
=
copy_str
<
Char
>
(
std
::
begin
(
buf
)
+
offset
,
std
::
end
(
buf
),
out_
);
out_
=
copy_str
<
Char
>
(
std
::
begin
(
buf
)
+
offset
,
std
::
end
(
buf
),
out_
);
}
}
void
on_utc_offset
()
{
void
on_utc_offset
()
{
format_utc_offset_impl
(
tm_
);
}
format_utc_offset_impl
(
has_member_data_tm_gmtoff
<
std
::
tm
>
{});
void
on_tz_name
()
{
format_tz_name_impl
(
tm_
);
}
}
void
on_tz_name
()
{
format_tz_name_impl
(
has_member_data_tm_zone
<
std
::
tm
>
{});
}
void
on_year
(
numeric_system
ns
)
{
void
on_year
(
numeric_system
ns
)
{
if
(
is_classic_
||
ns
==
numeric_system
::
standard
)
if
(
is_classic_
||
ns
==
numeric_system
::
standard
)
...
...
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