mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Fix conversion warning on chrono.h (#4170)
* Fix conversion warning on chrono.h warning: conversion from 'time_t' {aka 'long long int'} to 'long int' may change value [-Wconversion] * Changing write_utc_offset to accept a long long instead of the static_cast as requested..
This commit is contained in:
@ -1244,7 +1244,7 @@ class tm_writer {
|
|||||||
write_year_extended(year, pad);
|
write_year_extended(year, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_utc_offset(long offset, numeric_system ns) {
|
void write_utc_offset(long long offset, numeric_system ns) {
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
*out_++ = '-';
|
*out_++ = '-';
|
||||||
offset = -offset;
|
offset = -offset;
|
||||||
@ -1281,7 +1281,7 @@ class tm_writer {
|
|||||||
std::time_t gt = std::mktime(>m);
|
std::time_t gt = std::mktime(>m);
|
||||||
std::tm ltm = gmtime(gt);
|
std::tm ltm = gmtime(gt);
|
||||||
std::time_t lt = std::mktime(<m);
|
std::time_t lt = std::mktime(<m);
|
||||||
long offset = gt - lt;
|
long long offset = gt - lt;
|
||||||
write_utc_offset(offset, ns);
|
write_utc_offset(offset, ns);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user