From fe79932c2674f3a5eace0780b89e74c22b083880 Mon Sep 17 00:00:00 2001 From: Paulo Assis Date: Fri, 20 Sep 2024 20:47:27 -0300 Subject: [PATCH] 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.. --- include/fmt/chrono.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index ade6ec0a..5472eae0 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -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; @@ -1281,7 +1281,7 @@ class tm_writer { std::time_t gt = std::mktime(>m); std::tm ltm = gmtime(gt); std::time_t lt = std::mktime(<m); - long offset = gt - lt; + long long offset = gt - lt; write_utc_offset(offset, ns); #endif }