zipios 2.3.4
Zipios -- a small C++ library providing easy access to .zip files.
dosdatetime.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef ZIPIOS_DOSDATETIME_HPP
3#define ZIPIOS_DOSDATETIME_HPP
4
5/*
6 Zipios -- a small C++ library that provides easy access to .zip files.
7
8 Copyright (c) 2019-2022 Made to Order Software Corp. All Rights Reserved
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
32#include <cstdint>
33#include <ctime>
34
35#include <time.h>
36
37
38namespace zipios
39{
40
41
43{
44public:
45 typedef uint32_t dosdatetime_t;
46
47 static dosdatetime_t const g_min_dosdatetime = 0x00210000; // Jan 1, 1980 00:00:00
48 static dosdatetime_t const g_max_dosdatetime = 0xFF9FBF7D; // Dec 31, 2107 23:59:59
49
50 bool isValid() const;
51 int daysInMonth() const;
52 int getSecond() const;
53 int getMinute() const;
54 int getHour() const;
55 int getMDay() const;
56 int getMonth() const;
57 int getYear() const;
58 void setSecond(int second);
59 void setMinute(int minute);
60 void setHour(int hour);
61 void setMDay(int mday);
62 void setMonth(int month);
63 void setYear(int year);
65 void setDOSDateTime(dosdatetime_t datetime);
66 void setUnixTimestamp(std::time_t unix_timestamp);
67 std::time_t getUnixTimestamp() const;
68
69protected:
71};
72
73
74} // zipios namespace
75
76// Local Variables:
77// mode: cpp
78// indent-tabs-mode: nil
79// c-basic-offset: 4
80// tab-width: 4
81// End:
82
83// vim: ts=4 sw=4 et
84#endif
dosdatetime_t m_dosdatetime
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
int getMinute() const
Get the minute.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
bool isValid() const
Check whether this DOS Date & Date is valid.
int getSecond() const
Get the second.
int daysInMonth() const
Calculate the number of days in this date's month.
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
int getMonth() const
Get the month.
static dosdatetime_t const g_max_dosdatetime
static dosdatetime_t const g_min_dosdatetime
void setSecond(int second)
Set the second.
void setYear(int year)
Set the year.
void setHour(int hour)
Set the hour.
void setMonth(int month)
Set the month.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
int getMDay() const
Get the day of the month.
int getYear() const
Get the year.
void setMDay(int mday)
Set the day of the month.
void setMinute(int minute)
Set the minute.
int getHour() const
Get the hour.
The zipios namespace includes the Zipios library definitions.