Skip to content

Commit

Permalink
Eliminate msvc compiler warnings (fmtlib#931)
Browse files Browse the repository at this point in the history
The sheer presence of 'std::gmtime' or 'std::localtime' gives rise to C4996 warnings in Microsofts compilers. Alas, the 'fallback(internal::null<>)'functions containing these library calls are never ADL-picked in the respective 'handle(internal::null<>)' selectors. Therefore hiding the fallbacks from msvc is perfectly fine.
  • Loading branch information
DanielaE committed Nov 25, 2018
1 parent 7cde4ab commit f322056
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/fmt/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ inline std::tm localtime(std::time_t time) {

bool fallback(int res) { return res == 0; }

#ifndef _MSC_VER
#if !FMT_MSC_VER
bool fallback(internal::null<>) {
using namespace fmt::internal;
std::tm *tm = std::localtime(&time_);
Expand Down Expand Up @@ -90,7 +90,7 @@ inline std::tm gmtime(std::time_t time) {

bool fallback(int res) { return res == 0; }

#ifndef _MSC_VER
#if !FMT_MSC_VER
bool fallback(internal::null<>) {
std::tm *tm = std::gmtime(&time_);
if (tm) tm_ = *tm;
Expand Down

0 comments on commit f322056

Please sign in to comment.