comparison Core/SystemToolbox.cpp @ 2367:2aff870c2c58

refactoring of BoostConfiguration.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Aug 2017 17:32:13 +0200
parents 9e0eae8a5ea4
children 878b59270859
comparison
equal deleted inserted replaced
2366:26f3a346226f 2367:2aff870c2c58
33 33
34 #include "PrecompiledHeaders.h" 34 #include "PrecompiledHeaders.h"
35 #include "SystemToolbox.h" 35 #include "SystemToolbox.h"
36 36
37 37
38 #if BOOST_HAS_DATE_TIME == 1
39 # include <boost/date_time/posix_time/posix_time.hpp>
40 #endif
41
42
43 #if defined(_WIN32) 38 #if defined(_WIN32)
44 # include <windows.h> 39 # include <windows.h>
45 # include <process.h> // For "_spawnvp()" and "_getpid()" 40 # include <process.h> // For "_spawnvp()" and "_getpid()"
46 #else 41 #else
47 # include <unistd.h> // For "execvp()" 42 # include <unistd.h> // For "execvp()"
84 #include "OrthancException.h" 79 #include "OrthancException.h"
85 #include "Toolbox.h" 80 #include "Toolbox.h"
86 81
87 #include <boost/filesystem.hpp> 82 #include <boost/filesystem.hpp>
88 #include <boost/filesystem/fstream.hpp> 83 #include <boost/filesystem/fstream.hpp>
84 #include <boost/date_time/posix_time/posix_time.hpp>
89 85
90 86
91 namespace Orthanc 87 namespace Orthanc
92 { 88 {
93 static bool finish_; 89 static bool finish_;
563 #endif 559 #endif
564 return s; 560 return s;
565 } 561 }
566 562
567 563
568 #if BOOST_HAS_DATE_TIME == 1
569 std::string SystemToolbox::GetNowIsoString() 564 std::string SystemToolbox::GetNowIsoString()
570 { 565 {
571 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 566 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
572 return boost::posix_time::to_iso_string(now); 567 return boost::posix_time::to_iso_string(now);
573 } 568 }
574 569
570
575 void SystemToolbox::GetNowDicom(std::string& date, 571 void SystemToolbox::GetNowDicom(std::string& date,
576 std::string& time) 572 std::string& time)
577 { 573 {
578 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 574 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
579 tm tm = boost::posix_time::to_tm(now); 575 tm tm = boost::posix_time::to_tm(now);
584 580
585 // TODO milliseconds 581 // TODO milliseconds
586 sprintf(s, "%02d%02d%02d.%06d", tm.tm_hour, tm.tm_min, tm.tm_sec, 0); 582 sprintf(s, "%02d%02d%02d.%06d", tm.tm_hour, tm.tm_min, tm.tm_sec, 0);
587 time.assign(s); 583 time.assign(s);
588 } 584 }
589 #endif
590 } 585 }