File indexing completed on 2024-05-05 05:48:31
0001 /* 0002 CT Month Implementation 0003 -------------------------------------------------------------------- 0004 SPDX-FileCopyrightText: 1999 Gary Meyer <gary@meyer.net> 0005 -------------------------------------------------------------------- 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "cthour.h" 0010 0011 /** 0012 * Constructs from a tokenized string. 0013 */ 0014 CTHour::CTHour(const QString &tokStr) 0015 : CTUnit(0, 23, tokStr) 0016 { 0017 } 0018 0019 int CTHour::findPeriod() const 0020 { 0021 const QList<int> periods{2, 3, 4, 6, 8}; 0022 0023 return CTUnit::findPeriod(periods); 0024 } 0025 0026 QString CTHour::exportUnit() const 0027 { 0028 const int period = findPeriod(); 0029 if (period != 0 && period != 1) { 0030 return QStringLiteral("*/%1").arg(QString::number(period)); 0031 } 0032 0033 return CTUnit::exportUnit(); 0034 }