Changeset b28041a11 in mythtv
- Timestamp:
- Nov 21, 2012, 3:27:31 PM (12 years ago)
- Branches:
- fixes/0.26
- Children:
- 93204a3747
- Parents:
- 3c359636b
- git-author:
- Daniel Thor Kristjansson <danielk@…> (11/21/12 15:27:31)
- git-committer:
- Stuart Morgan <smorgan@…> (12/02/12 14:00:44)
- Location:
- mythtv/programs/mythshutdown
- Files:
-
- 2 edited
-
commandlineparser.cpp (modified) (2 diffs)
-
main.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mythtv/programs/mythshutdown/commandlineparser.cpp
r3c359636b rb28041a11 23 23 << add(QStringList( QStringList() << "-w" << "--setwakeup" ), 24 24 "setwakeup", "", 25 "Set the wakeup time (yyyy-MM-ddThh:mm:ss)", "") 25 "Set the wakeup time (yyyy-MM-ddThh:mm:ss) " 26 "default is in local time", "") 26 27 << add(QStringList( QStringList() << "-t" << "--setscheduledwakeup" ), 27 28 "setschedwakeup", false, … … 67 68 " 128 - Less than 15 minutes to next wakeup period\n" 68 69 " 255 - Setup is running") ); 70 71 // The localtime command line parameter exists solely to make scripts 72 // using this executable self documenting. 73 74 CommandLineArg::AllowOneOf( QList<CommandLineArg*>() 75 << add("--utc", 76 "utc", false, 77 "Specify that the wakeup time is in utc", "") 78 << add("--localtime", 79 "localtime", false, 80 "Specify that the wakeup time is in local time", "") ); 69 81 } 70 82 -
mythtv/programs/mythshutdown/main.cpp
r3c359636b rb28041a11 376 376 } 377 377 378 static int setWakeupTime(QString sWakeupTime)378 static void setWakeupTime(const QDateTime &wakeupTime) 379 379 { 380 380 LOG(VB_GENERAL, LOG_INFO, "Mythshutdown: --setwakeup"); 381 381 382 382 LOG(VB_GENERAL, LOG_NOTICE, 383 QString("Mythshutdown: wakeup time given is: %1").arg(sWakeupTime)); 384 385 // check time given is valid 386 QDateTime dtWakeupTime; 387 dtWakeupTime = MythDate::fromString(sWakeupTime); 388 389 if (!dtWakeupTime.isValid()) 390 { 391 LOG(VB_GENERAL, LOG_ERR, 392 QString("Mythshutdown: --setwakeup invalid date " 393 "format (%1)\n\t\t\t" 394 "must be yyyy-MM-ddThh:mm:ss") 395 .arg(sWakeupTime)); 396 return 1; 397 } 383 QString("Mythshutdown: wakeup time given is: %1 (local time)") 384 .arg(MythDate::toString(wakeupTime))); 398 385 399 386 setGlobalSetting("MythShutdownNextScheduled", 400 MythDate::toString(dtWakeupTime, MythDate::kDatabase)); 401 402 return 0; 387 MythDate::toString(wakeupTime, MythDate::kDatabase)); 403 388 } 404 389 … … 433 418 restarttime = restarttime.addSecs((-1) * add); 434 419 435 setWakeupTime(restarttime .toString(Qt::ISODate));420 setWakeupTime(restarttime); 436 421 437 422 return 0; … … 822 807 res = getStatus((bool)(cmdline.toInt("status") == 1)); 823 808 else if (cmdline.toBool("setwakeup")) 824 res = setWakeupTime(cmdline.toString("setwakeup")); 809 { 810 // only one of --utc or --localtime can be passed per 811 // CommandLineArg::AllowOneOf() in commandlineparser.cpp 812 bool utc = cmdline.toBool("utc"); 813 QString tmp = cmdline.toString("setwakeup"); 814 815 QDateTime wakeuptime = (utc) ? 816 MythDate::fromString(tmp) : 817 QDateTime::fromString(tmp, Qt::ISODate).toUTC(); 818 819 if (!wakeuptime.isValid()) 820 { 821 cerr << qPrintable( 822 QObject::tr("mythshutdown: --setwakeup invalid date " 823 "format (%1)\n\t\t\t" 824 "must be yyyy-MM-ddThh:mm:ss") 825 .arg(tmp)) << endl; 826 res = 1; 827 } 828 else 829 { 830 setWakeupTime(wakeuptime); 831 } 832 } 825 833 else if (cmdline.toBool("safeshutdown")) 826 834 {
Note: See TracChangeset
for help on using the changeset viewer.
