Skip to content

Commit

Permalink
Fix conversion warning on chrono.h (#4170)
Browse files Browse the repository at this point in the history
* 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..
  • Loading branch information
Ottani authored Sep 20, 2024
1 parent 23fcf19 commit fe79932
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ class tm_writer {
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) {
*out_++ = '-';
offset = -offset;
Expand Down Expand Up @@ -1281,7 +1281,7 @@ class tm_writer {
std::time_t gt = std::mktime(&gtm);
std::tm ltm = gmtime(gt);
std::time_t lt = std::mktime(&ltm);
long offset = gt - lt;
long long offset = gt - lt;
write_utc_offset(offset, ns);
#endif
}
Expand Down

0 comments on commit fe79932

Please sign in to comment.