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 "ctminute.h" 0010 0011 /** 0012 * Constructs from a tokenized string. 0013 */ 0014 CTMinute::CTMinute(const QString &tokStr) 0015 : CTUnit(0, 59, tokStr) 0016 { 0017 } 0018 0019 CTMinute::CTMinute() 0020 : CTUnit(0, 59, QLatin1String("")) 0021 { 0022 } 0023 0024 int CTMinute::findPeriod() const 0025 { 0026 const QList<int> periods{1, 2, 5, 10, 15, 20, 30}; 0027 0028 return CTUnit::findPeriod(periods); 0029 } 0030 0031 QString CTMinute::exportUnit() const 0032 { 0033 const int period = findPeriod(); 0034 if (period != 0 && period != 1) { 0035 return QStringLiteral("*/%1").arg(QString::number(period)); 0036 } 0037 0038 return CTUnit::exportUnit(); 0039 }