libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
DateTime.h
1/*
2 * Copyright 2020 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIB_QUENTIER_UTILITY_DATE_TIME_H
20#define LIB_QUENTIER_UTILITY_DATE_TIME_H
21
22#include <quentier/utility/Linkage.h>
23
24#include <QFlags>
25
26namespace quentier {
27
28constexpr int secondsToMilliseconds(int seconds) noexcept
29{
30 return seconds * 1000;
31}
32
37class QUENTIER_EXPORT DateTimePrint
38{
39public:
43 enum Option
44 {
49 IncludeNumericTimestamp = 1 << 1,
53 IncludeMilliseconds = 1 << 2,
59 IncludeTimezone = 1 << 3
60 };
61 Q_DECLARE_FLAGS(Options, Option)
62};
63
64Q_DECLARE_OPERATORS_FOR_FLAGS(DateTimePrint::Options)
65
66
83const QString QUENTIER_EXPORT printableDateTimeFromTimestamp(
84 const qint64 timestamp,
85 DateTimePrint::Options options = DateTimePrint::Options(
88 const char * customFormat = nullptr);
89
90} // namespace quentier
91
92#endif // LIB_QUENTIER_UTILITY_DATE_TIME_H
The DateTimePrint class simply wraps the enum containing datetime printing options.
Definition DateTime.h:38
Option
Definition DateTime.h:44
@ IncludeTimezone
Definition DateTime.h:59
@ IncludeNumericTimestamp
Definition DateTime.h:49
@ IncludeMilliseconds
Definition DateTime.h:53