kdelibs/kdecore/date/kdatetime.h

65 lines
2.2 KiB
C
Raw Normal View History

2014-11-13 01:04:59 +02:00
/*
This file is part of the KDE libraries
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
2014-11-13 01:04:59 +02:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDATETIME_H
#define KDATETIME_H
2014-11-13 01:04:59 +02:00
#include <ktimezone.h>
#include <QMetaType>
#include <QDataStream>
2014-11-13 01:04:59 +02:00
/**
* @short A class representing a date and time with an associated time zone
*
* @see KTimeZone, KSystemTimeZones, QDateTime, QDate, QTime
* @see <a href="http://www.w3.org/TR/timezone/">W3C: Working with Time Zones</a>
* @author Ivailo Monev \<xakepa10@gmail.com\>.
* @warning KDateTime and KLocale do not output interchangable formats
2014-11-13 01:04:59 +02:00
*/
class KDECORE_EXPORT KDateTime : public QDateTime
2014-11-13 01:04:59 +02:00
{
public:
2014-11-13 01:04:59 +02:00
KDateTime();
KDateTime(const QDate &date);
KDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec = Qt::LocalTime);
KDateTime(const QDateTime &other);
2014-11-13 01:04:59 +02:00
KDateTime(const KDateTime &other);
KTimeZone timeZone() const;
bool isNightTime() const;
2014-11-13 01:04:59 +02:00
static QDate currentLocalDate();
2014-11-13 01:04:59 +02:00
static KDateTime currentLocalDateTime();
static KDateTime currentUtcDateTime();
static KDateTime currentDateTime(const KTimeZone &zone);
2014-11-13 01:04:59 +02:00
};
Q_DECLARE_METATYPE(KDateTime)
QT_BEGIN_NAMESPACE
/** Write @p kdt to the datastream @p out, in binary format. */
QDataStream KDECORE_EXPORT& operator<<(QDataStream &out, const KDateTime &kdt);
/** Read a KDateTime object into @p kdt from @p in, in binary format. */
QDataStream KDECORE_EXPORT& operator>>(QDataStream &in, KDateTime &kdt);
QT_END_NAMESPACE
2014-11-13 01:04:59 +02:00
#endif // KDATETIME_H