always cache gmt offset
This commit is contained in:
		@@ -593,14 +593,7 @@ public:
 | 
				
			|||||||
        const size_t field_size = 6;
 | 
					        const size_t field_size = 6;
 | 
				
			||||||
        ScopedPadder p(field_size, padinfo_, dest);
 | 
					        ScopedPadder p(field_size, padinfo_, dest);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef _WIN32
 | 
					        auto total_minutes = get_cached_offset(msg, tm_time);
 | 
				
			||||||
        int total_minutes = get_cached_offset(msg, tm_time);
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        // No need to cache under gcc,
 | 
					 | 
				
			||||||
        // it is very fast (already stored in tm.tm_gmtoff)
 | 
					 | 
				
			||||||
        (void)(msg);
 | 
					 | 
				
			||||||
        int total_minutes = os::utc_minutes_offset(tm_time);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        bool is_negative = total_minutes < 0;
 | 
					        bool is_negative = total_minutes < 0;
 | 
				
			||||||
        if (is_negative)
 | 
					        if (is_negative)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -619,7 +612,6 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    log_clock::time_point last_update_{std::chrono::seconds(0)};
 | 
					    log_clock::time_point last_update_{std::chrono::seconds(0)};
 | 
				
			||||||
#ifdef _WIN32
 | 
					 | 
				
			||||||
    int offset_minutes_{0};
 | 
					    int offset_minutes_{0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int get_cached_offset(const log_msg &msg, const std::tm &tm_time)
 | 
					    int get_cached_offset(const log_msg &msg, const std::tm &tm_time)
 | 
				
			||||||
@@ -632,7 +624,6 @@ private:
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return offset_minutes_;
 | 
					        return offset_minutes_;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Thread id
 | 
					// Thread id
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user