Browse Source

timestamp will just be a unixtimestamp

logicp 5 years ago
parent
commit
49ad05d9c9
3 changed files with 5 additions and 5 deletions
  1. 1 1
      argdialog.cpp
  2. 1 1
      ky_gui.pro.user
  3. 3 3
      mainwindow.cpp

+ 1 - 1
argdialog.cpp

@@ -65,7 +65,7 @@ ArgDialog::ArgDialog(QWidget *parent) :
 
     QObject::connect(ui->dateTime, &QDateTimeEdit::dateTimeChanged, this, [this]() {
         auto date_time = ui->dateTime->dateTime();
-        m_ig_post.datetime = std::string{date_time.toString().toUtf8().data()};
+        m_ig_post.datetime = std::string{std::to_string(date_time.toTime_t())};
         qDebug() << "Time changed to" << date_time;
     });
 

+ 1 - 1
ky_gui.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.11.0, 2020-01-05T22:31:56. -->
+<!-- Written by QtCreator 4.11.0, 2020-01-06T20:24:31. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 3 - 3
mainwindow.cpp

@@ -96,9 +96,9 @@ void MainWindow::connectClient() {
         auto mask = q_client->getSelectedApp();
         if (mask > -1) {
             if (q_client->getAppName(mask) == "Instagram") {
-                auto datetime = QDateTime::fromString(task.args.at(1).c_str());
-                auto current_datetime = QDateTime::currentDateTime();
-                auto seconds_diff = current_datetime.secsTo(datetime);
+                auto datetime = task.args.at(1);
+                auto current_datetime = QDateTime::currentDateTime().toTime_t();
+                auto seconds_diff = std::stoi(datetime) - current_datetime;
                 qDebug() << "Time difference: " << seconds_diff;
                 if (seconds_diff > 3600) {
                     qDebug() << "Scheduling a task";