From dee93e5eeb0b6e0198e9ce63d788a13bfbf3e658 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 14 Dec 2017 17:24:29 +0100 Subject: [PATCH] Minor fix: rename LIB_PART::m_dateModified to LIB_PART::LIB_PART::m_dateLastEdition and use m_dateLastEdition type for LIB_PART::m_dateLastEdition --- eeschema/class_libentry.cpp | 20 ++++++++++---------- eeschema/class_libentry.h | 4 ++-- eeschema/sch_legacy_plugin.cpp | 16 +++++++--------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index da23af39b4..7476da6570 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -151,7 +151,7 @@ LIB_PART::LIB_PART( const wxString& aName, PART_LIB* aLibrary ) : EDA_ITEM( LIB_PART_T ), m_me( this, null_deleter() ) { - m_dateModified = 0; + m_dateLastEdition = 0; m_unitCount = 1; m_pinNameOffset = 40; m_options = ENTRY_NORMAL; @@ -184,7 +184,7 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : m_pinNameOffset = aPart.m_pinNameOffset; m_showPinNumbers = aPart.m_showPinNumbers; m_showPinNames = aPart.m_showPinNames; - m_dateModified = aPart.m_dateModified; + m_dateLastEdition = aPart.m_dateLastEdition; m_options = aPart.m_options; m_libId = aPart.m_libId; @@ -848,15 +848,15 @@ bool LIB_PART::SaveDateAndTime( OUTPUTFORMATTER& aFormatter ) { int year, mon, day, hour, min, sec; - if( m_dateModified == 0 ) + if( m_dateLastEdition == 0 ) return true; - sec = m_dateModified & 63; - min = ( m_dateModified >> 6 ) & 63; - hour = ( m_dateModified >> 12 ) & 31; - day = ( m_dateModified >> 17 ) & 31; - mon = ( m_dateModified >> 22 ) & 15; - year = ( m_dateModified >> 26 ) + 1990; + sec = m_dateLastEdition & 63; + min = ( m_dateLastEdition >> 6 ) & 63; + hour = ( m_dateLastEdition >> 12 ) & 31; + day = ( m_dateLastEdition >> 17 ) & 31; + mon = ( m_dateLastEdition >> 22 ) & 15; + year = ( m_dateLastEdition >> 26 ) + 1990; aFormatter.Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec ); @@ -875,7 +875,7 @@ bool LIB_PART::LoadDateAndTime( char* aLine ) if( sscanf( aLine, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 ) return false; - m_dateModified = ( sec & 63 ) + ( ( min & 63 ) << 6 ) + + m_dateLastEdition = ( sec & 63 ) + ( ( min & 63 ) << 6 ) + ( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) + ( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 ); diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 3af8684e63..4e9de9201a 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -221,7 +221,7 @@ class LIB_PART : public EDA_ITEM ///< one unit does not automatically change another unit. bool m_showPinNames; ///< Determines if part pin names are visible. bool m_showPinNumbers; ///< Determines if part pin numbers are visible. - long m_dateModified; ///< Date the part was last modified. + timestamp_t m_dateLastEdition; ///< Date of the last modification. LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.) int m_unitCount; ///< Number of units (parts) per package. LIB_ITEMS_CONTAINER m_drawings; ///< Drawing items of this part. @@ -280,7 +280,7 @@ public: LIB_ALIAS* GetAlias( const wxString& aName ); - long GetDateModified() const { return m_dateModified; } + timestamp_t GetDateLastEdition() const { return m_dateLastEdition; } /** * Add an alias \a aName to the part. diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 41238128d1..413bcf9e70 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -3457,18 +3457,16 @@ void SCH_LEGACY_PLUGIN_CACHE::saveSymbol( LIB_PART* aSymbol, aSymbol->GetUnitCount(), aSymbol->UnitsLocked() ? 'L' : 'F', aSymbol->IsPower() ? 'P' : 'N' ); - long dateModified = aSymbol->GetDateModified(); + timestamp_t dateModified = aSymbol->GetDateLastEdition(); if( dateModified != 0 ) { - int year, mon, day, hour, min, sec; - - sec = dateModified & 63; - min = ( dateModified >> 6 ) & 63; - hour = ( dateModified >> 12 ) & 31; - day = ( dateModified >> 17 ) & 31; - mon = ( dateModified >> 22 ) & 15; - year = ( dateModified >> 26 ) + 1990; + int sec = dateModified & 63; + int min = ( dateModified >> 6 ) & 63; + int hour = ( dateModified >> 12 ) & 31; + int day = ( dateModified >> 17 ) & 31; + int mon = ( dateModified >> 22 ) & 15; + int year = ( dateModified >> 26 ) + 1990; aFormatter->Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec ); }