mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:40:06 +00:00 
			
		
		
		
	Use HH date library when not using MSVC
This commit is contained in:
		
							parent
							
								
									e78dc9b3db
								
							
						
					
					
						commit
						593010acc2
					
				
					 10 changed files with 98 additions and 14 deletions
				
			
		|  | @ -8,6 +8,10 @@ | |||
| 
 | ||||
| #include <sstream> | ||||
| 
 | ||||
| #if !defined(_MSC_VER) | ||||
| #   include <date/date.h> | ||||
| #endif | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace awips | ||||
|  | @ -98,6 +102,10 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | |||
|       { | ||||
|          using namespace std::chrono; | ||||
| 
 | ||||
| #if !defined(_MSC_VER) | ||||
|          using namespace date; | ||||
| #endif | ||||
| 
 | ||||
|          static const std::string timeFormat {"%H%MZ"}; | ||||
| 
 | ||||
|          std::istringstream in {time}; | ||||
|  | @ -106,12 +114,12 @@ bool CodedTimeMotionLocation::Parse(const StringRange& lines, | |||
| 
 | ||||
|          if (time.size() == 5 && !in.fail()) | ||||
|          { | ||||
|             p->time_ = hh_mm_ss {tp}; | ||||
|             p->time_ = std::chrono::hh_mm_ss {tp}; | ||||
|          } | ||||
|          else | ||||
|          { | ||||
|             logger_->warn("Invalid time: \"{}\"", time); | ||||
|             p->time_  = hh_mm_ss<minutes> {}; | ||||
|             p->time_  = std::chrono::hh_mm_ss<minutes> {}; | ||||
|             dataValid = false; | ||||
|          } | ||||
|       } | ||||
|  |  | |||
|  | @ -12,6 +12,10 @@ | |||
| #include <boost/bimap.hpp> | ||||
| #include <boost/bimap/unordered_set_of.hpp> | ||||
| 
 | ||||
| #if !defined(_MSC_VER) | ||||
| #   include <date/date.h> | ||||
| #endif | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace awips | ||||
|  | @ -87,7 +91,7 @@ public: | |||
| PVtec::PVtec() : p(std::make_unique<PVtecImpl>()) {} | ||||
| PVtec::~PVtec() = default; | ||||
| 
 | ||||
| PVtec::PVtec(PVtec&&) noexcept = default; | ||||
| PVtec::PVtec(PVtec&&) noexcept            = default; | ||||
| PVtec& PVtec::operator=(PVtec&&) noexcept = default; | ||||
| 
 | ||||
| PVtec::ProductType PVtec::fixed_identifier() const | ||||
|  | @ -134,6 +138,10 @@ bool PVtec::Parse(const std::string& s) | |||
| { | ||||
|    using namespace std::chrono; | ||||
| 
 | ||||
| #if !defined(_MSC_VER) | ||||
|    using namespace date; | ||||
| #endif | ||||
| 
 | ||||
|    // P-VTEC takes the form:
 | ||||
|    // /k.aaa.cccc.pp.s.####.yymmddThhnnZ-yymmddThhnnZ/
 | ||||
|    // 012345678901234567890123456789012345678901234567
 | ||||
|  | @ -187,8 +195,8 @@ bool PVtec::Parse(const std::string& s) | |||
|       std::istringstream ssEventBegin {sEventBegin}; | ||||
|       std::istringstream ssEventEnd {sEventEnd}; | ||||
| 
 | ||||
|       sys_time<minutes> eventBegin; | ||||
|       sys_time<minutes> eventEnd; | ||||
|       std::chrono::sys_time<minutes> eventBegin; | ||||
|       std::chrono::sys_time<minutes> eventEnd; | ||||
| 
 | ||||
|       ssEventBegin >> parse(dateTimeFormat, eventBegin); | ||||
|       ssEventEnd >> parse(dateTimeFormat, eventEnd); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat