mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-07 01:13:50 +02:00
* Refactored routines for parsing/writing standard date/time strings (RFC822 and XML xs:dateTime formats) into 'lib/rddatetime.[cpp|h]. * Removed the 'RDWebDateTime()', 'RDGetWebDateTime()', 'RDGetWebDate()', 'RDGetWebTime()', 'RDGetWebMonth()', 'RDXmlDate()', 'RDXmlTime()', 'RDXmlDateTime()' and 'RDXmlTimeZoneSuffix()' functions from 'lib/rdweb.[cpp|h]. * Added a 'dateparse_test' test harness.
67 lines
1.7 KiB
C
67 lines
1.7 KiB
C
// rddatetime.h
|
|
//
|
|
// Parse and write dates/times in various standard formats.
|
|
//
|
|
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License version 2 as
|
|
// published by the Free Software Foundation.
|
|
//
|
|
// This program 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 General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public
|
|
// License along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
//
|
|
|
|
#ifndef RDDATETIME_H
|
|
#define RDDATETIME_H
|
|
|
|
#include <qstring.h>
|
|
#include <qdatetime.h>
|
|
|
|
//
|
|
// Function Prototypes
|
|
//
|
|
|
|
//
|
|
// Auto-detect the format (XML xs:dateTime or RFC822)
|
|
//
|
|
QDateTime RDParseDateTime(const QString &str,bool *ok);
|
|
|
|
//
|
|
// XML xs:date format
|
|
//
|
|
QDate RDParseXmlDate(const QString &str,bool *ok);
|
|
QString RDWriteXmlDate(const QDate &date);
|
|
|
|
//
|
|
// XML xs:time format
|
|
//
|
|
QTime RDParseXmlTime(const QString &str,bool *ok,int *day_offset=NULL);
|
|
QString RDWriteXmlTime(const QTime &time);
|
|
|
|
//
|
|
// XML xs:dateTime format
|
|
//
|
|
QDateTime RDParseXmlDateTime(const QString &str,bool *ok);
|
|
QString RDWriteXmlDateTime(const QDateTime &dt);
|
|
|
|
//
|
|
// RFC822 date/time format
|
|
//
|
|
QDateTime RDParseRfc822DateTime(const QString &str,bool *ok);
|
|
QString RDWriteRfc822DateTime(const QDateTime &dt);
|
|
|
|
//
|
|
// Returns the UTC offset of the curently configured timezone (seconds)
|
|
//
|
|
int RDTimeZoneOffset();
|
|
|
|
|
|
#endif // RDDATETIME_H
|