Webdar 1.0.0
Web user interface to libdar
date.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef DATE_HPP
25#define DATE_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31#if HAVE_TIME_H
32#include <time.h>
33#endif
34
35#if HAVE_CTYPE_H
36#include <ctype.h>
37#endif
38}
39
40 // C++ system header files
41#include <string>
42
43 // webdar headers
44
45
47
48class date
49{
50public:
52 date();
53
57 date(const std::string & when);
58
60 std::string get_canonical_format() const;
61
62 bool operator < (const date & ref) const;
63 bool operator <= (const date & ref) const { return *this < ref || *this == ref; };
64 bool operator == (const date & ref) const;
65private:
66 struct tm val; // date is stored as UTC
67
68};
69
70
71#endif
stores and manipulates date-time and its formatting to human representation
Definition: date.hpp:49
date()
constructor, date'value is "now"
Definition: date.cpp:46
std::string get_canonical_format() const
returns date in RFC 1123 format
Definition: date.cpp:68