lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6090] Prefer calendar_date to wxDateTime


From: Greg Chicares
Subject: [lmi-commits] [6090] Prefer calendar_date to wxDateTime
Date: Fri, 23 Jan 2015 02:13:17 +0000

Revision: 6090
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6090
Author:   chicares
Date:     2015-01-23 02:13:16 +0000 (Fri, 23 Jan 2015)
Log Message:
-----------
Prefer calendar_date to wxDateTime

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-01-22 19:41:22 UTC (rev 6089)
+++ lmi/trunk/ChangeLog 2015-01-23 02:13:16 UTC (rev 6090)
@@ -35544,3 +35544,9 @@
   wx_test_config_settings.cpp
 Add an overlooked skin (KMM).
 
+20150123T0213Z <address@hidden> [516]
+
+  skeleton.cpp
+Prefer calendar_date to wxDateTime. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-12/msg00085.html
+

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2015-01-22 19:41:22 UTC (rev 6089)
+++ lmi/trunk/skeleton.cpp      2015-01-23 02:13:16 UTC (rev 6090)
@@ -91,7 +91,6 @@
 #include <wx/artprov.h>
 #include <wx/config.h>
 #include <wx/cshelp.h>
-#include <wx/datetime.h>
 #include <wx/debug.h>                   // wxIsDebuggerRunning()
 #include <wx/docmdi.h>
 #include <wx/image.h>
@@ -1244,25 +1243,21 @@
 
             case 004:
                 {
-                wxString const date_string(getopt_long.optarg);
-                wxDateTime dt;
-                wxString::const_iterator date_end;
-                if(  !dt.ParseFormat(date_string, "%Y%m%d", &date_end)
-                  || date_end != date_string.end()
-                  )
+                std::istringstream iss(getopt_long.optarg);
+                int ymd_as_int;
+                iss >> ymd_as_int;
+                if(!iss || !iss.eof())
                     {
                     warning() << "Invalid prospicience option value '"
-                              << date_string
+                              << getopt_long.optarg
                               << "' (must be in YYYYMMDD format)."
                               << std::flush
                               ;
                     }
                 else
                     {
-                    // wxDateTime JDN corresponds to the noon, not the
-                    // midnight, and so requires half a day adjustment.
                     global_settings::instance().set_prospicience_date
-                        (calendar_date(jdn_t(wxRound(dt.GetJDN() + 0.5)))
+                        (calendar_date(ymd_t(ymd_as_int))
                         );
                     }
                 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]