Commit a2f42e64 authored by Max Kellermann's avatar Max Kellermann

time/ISO8601: use <cstdlib>

parent bdfe6c2c
...@@ -35,10 +35,9 @@ ...@@ -35,10 +35,9 @@
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include <cassert> #include <cassert>
#include <cstdlib>
#include <stdexcept> #include <stdexcept>
#include <stdlib.h>
StringBuffer<64> StringBuffer<64>
FormatISO8601(const struct tm &tm) noexcept FormatISO8601(const struct tm &tm) noexcept
{ {
...@@ -65,7 +64,7 @@ static std::pair<unsigned, unsigned> ...@@ -65,7 +64,7 @@ static std::pair<unsigned, unsigned>
ParseTimeZoneOffsetRaw(const char *&s) ParseTimeZoneOffsetRaw(const char *&s)
{ {
char *endptr; char *endptr;
unsigned long value = strtoul(s, &endptr, 10); unsigned long value = std::strtoul(s, &endptr, 10);
if (endptr == s + 4) { if (endptr == s + 4) {
s = endptr; s = endptr;
return std::make_pair(value / 100, value % 100); return std::make_pair(value / 100, value % 100);
...@@ -75,7 +74,7 @@ ParseTimeZoneOffsetRaw(const char *&s) ...@@ -75,7 +74,7 @@ ParseTimeZoneOffsetRaw(const char *&s)
unsigned hours = value, minutes = 0; unsigned hours = value, minutes = 0;
if (*s == ':') { if (*s == ':') {
++s; ++s;
minutes = strtoul(s, &endptr, 10); minutes = std::strtoul(s, &endptr, 10);
if (endptr != s + 2) if (endptr != s + 2)
throw std::runtime_error("Failed to parse time zone offset"); throw std::runtime_error("Failed to parse time zone offset");
......
...@@ -36,9 +36,8 @@ ...@@ -36,9 +36,8 @@
#include "util/Compiler.h" #include "util/Compiler.h"
#include <chrono> #include <chrono>
#include <utility>
#include <cstddef> #include <cstddef>
#include <utility>
struct tm; struct tm;
template<size_t CAPACITY> class StringBuffer; template<size_t CAPACITY> class StringBuffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment