Update to version 3.2
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#ifndef GEMPA_CAPS_DATETIME_H
|
||||
#define GEMPA_CAPS_DATETIME_H
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
@@ -24,8 +25,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
struct tm;
|
||||
|
||||
|
||||
namespace Gempa {
|
||||
namespace CAPS {
|
||||
|
||||
@@ -64,6 +67,7 @@ class TimeSpan {
|
||||
//! Assignment
|
||||
TimeSpan& operator=(long t);
|
||||
TimeSpan& operator=(double t);
|
||||
TimeSpan& operator=(const TimeSpan& t);
|
||||
|
||||
//! Arithmetic
|
||||
TimeSpan operator+(const TimeSpan&) const;
|
||||
@@ -205,24 +209,25 @@ class Time : public TimeSpan {
|
||||
//! Returns whether the date is valid or not
|
||||
bool valid() const;
|
||||
|
||||
/** Converts the time to string using format fmt.
|
||||
@param fmt The format string can contain any specifiers
|
||||
as allowed for strftime. Additional the '%f'
|
||||
specifier is replaced by the fraction of the seconds.
|
||||
Example:
|
||||
toString("%FT%T.%fZ") = "1970-01-01T00:00:00.0000Z"
|
||||
@return A formatted string
|
||||
/**
|
||||
* @brief Converts the time to string using format fmt.
|
||||
* @param fmt The format string can contain any specifiers
|
||||
* as allowed for strftime. Additional the '%f'
|
||||
* specifier is replaced by the fraction of the seconds.
|
||||
* Example:
|
||||
* toString("%FT%T.%fZ") = "1970-01-01T00:00:00.0000Z"
|
||||
* @return A formatted string
|
||||
*/
|
||||
std::string toString(const char* fmt) const;
|
||||
|
||||
/**
|
||||
* Converts the time to a string using the ISO time description
|
||||
* @brief Converts the time to a string using the ISO time description
|
||||
* @return A formatted string
|
||||
*/
|
||||
std::string iso() const;
|
||||
|
||||
/**
|
||||
* Converts a string into a time representation.
|
||||
* @brief Converts a string into a time representation.
|
||||
* @param str The string representation of the time
|
||||
* @param fmt The format string containing the conversion
|
||||
* specification (-> toString)
|
||||
@@ -230,11 +235,37 @@ class Time : public TimeSpan {
|
||||
*/
|
||||
bool fromString(const char* str, const char* fmt);
|
||||
|
||||
/**
|
||||
* @brief Converts a string into a time representation trying a common
|
||||
* set of date formats.
|
||||
* @param str The string representation of the time.
|
||||
* @return The conversion result
|
||||
*/
|
||||
bool fromString(const char* str);
|
||||
|
||||
/**
|
||||
* @brief Convenience method for fromString(const char*).
|
||||
*/
|
||||
bool fromString(const std::string& str);
|
||||
|
||||
/**
|
||||
* Static method to create a time value from a string.
|
||||
* The parameters are the same as in Time::fromString.
|
||||
*/
|
||||
static Time FromString(const char* str, const char* fmt);
|
||||
|
||||
/**
|
||||
* @brief Static methods that converts a string into a time
|
||||
* representation trying a common set of date formats.
|
||||
* @param str The string representation of the time.
|
||||
* @return The conversion result
|
||||
*/
|
||||
static Time FromString(const char* str);
|
||||
|
||||
/**
|
||||
* @brief Convenience method for FromString(const char*).
|
||||
*/
|
||||
static Time FromString(const std::string& str);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user