diff Core/DicomParsing/DicomDirWriter.cpp @ 2475:8cc3ca64a534

Orthanc now uses UTC (universal time) instead of local time in its database
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Feb 2018 16:55:05 +0100
parents 878b59270859
children a84ce82fd55b
line wrap: on
line diff
--- a/Core/DicomParsing/DicomDirWriter.cpp	Thu Feb 08 11:51:41 2018 +0100
+++ b/Core/DicomParsing/DicomDirWriter.cpp	Mon Feb 19 16:55:05 2018 +0100
@@ -128,6 +128,7 @@
   class DicomDirWriter::PImpl
   {
   private:
+    bool                       utc_;
     std::string                fileSetId_;
     bool                       extendedSopClass_;
     TemporaryFile              file_;
@@ -259,11 +260,23 @@
 
   public:
     PImpl() :
+      utc_(true),   // By default, use UTC (universal time, not local time)
       fileSetId_("ORTHANC_MEDIA"),
       extendedSopClass_(false)
     {
     }
+    
+    bool IsUtcUsed() const
+    {
+      return utc_;
+    }
 
+
+    void SetUtcUsed(bool utc)
+    {
+      utc_ = utc;
+    }
+    
     void EnableExtendedSopClass(bool enable)
     {
       if (enable)
@@ -297,7 +310,7 @@
       // cf. "DicomDirInterface::buildStudyRecord()"
 
       std::string nowDate, nowTime;
-      SystemToolbox::GetNowDicom(nowDate, nowTime);
+      SystemToolbox::GetNowDicom(nowDate, nowTime, utc_);
 
       std::string studyDate;
       if (!GetUtf8TagValue(studyDate, dicom, encoding, DCM_StudyDate) &&
@@ -496,6 +509,16 @@
     }
   }
 
+  void DicomDirWriter::SetUtcUsed(bool utc)
+  {
+    pimpl_->SetUtcUsed(utc);
+  }
+  
+  bool DicomDirWriter::IsUtcUsed() const
+  {
+    return pimpl_->IsUtcUsed();
+  }
+
   void DicomDirWriter::SetFileSetId(const std::string& id)
   {
     pimpl_->SetFileSetId(id);