Rationalize numeric time stamps to type time_t.

This commit is contained in:
Lorenzo Marcantonio 2012-05-24 21:52:04 -04:00 committed by Wayne Stambaugh
parent 6e78a592f2
commit 925774760c
12 changed files with 26 additions and 24 deletions

View File

@ -325,10 +325,10 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags )
} }
unsigned long GetNewTimeStamp() time_t GetNewTimeStamp()
{ {
static unsigned long oldTimeStamp; static time_t oldTimeStamp;
unsigned long newTimeStamp; time_t newTimeStamp;
newTimeStamp = time( NULL ); newTimeStamp = time( NULL );

View File

@ -91,6 +91,7 @@ class CMP_LIBRARY
{ {
int type; ///< Library type indicator. int type; ///< Library type indicator.
wxFileName fileName; ///< Library file name. wxFileName fileName; ///< Library file name.
// ZZZ why this a wxDateTime where others are time_t?
wxDateTime timeStamp; ///< Library save time and date. wxDateTime timeStamp; ///< Library save time and date.
int versionMajor; ///< Library major version number. int versionMajor; ///< Library major version number.
int versionMinor; ///< Library minor version number. int versionMinor; ///< Library minor version number.

View File

@ -73,7 +73,7 @@ private:
SCH_SHEET_PATH m_SheetPath; ///< The sheet path for this reference. SCH_SHEET_PATH m_SheetPath; ///< The sheet path for this reference.
bool m_IsNew; ///< True if not yet annotated. bool m_IsNew; ///< True if not yet annotated.
int m_SheetNum; ///< The sheet number for the reference. int m_SheetNum; ///< The sheet number for the reference.
unsigned long m_TimeStamp; ///< The time stamp for the reference. time_t m_TimeStamp; ///< The time stamp for the reference.
wxString* m_Value; ///< The component value of the refernce. It is the wxString* m_Value; ///< The component value of the refernce. It is the
///< same for all instances. ///< same for all instances.
int m_NumRef; ///< The numeric part of the reference designator. int m_NumRef; ///< The numeric part of the reference designator.

View File

@ -195,7 +195,7 @@ public:
* @see m_PathsAndReferences * @see m_PathsAndReferences
* @param aNewTimeStamp = new time stamp * @param aNewTimeStamp = new time stamp
*/ */
void SetTimeStamp( long aNewTimeStamp ); void SetTimeStamp( time_t aNewTimeStamp );
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;

View File

@ -400,7 +400,7 @@ protected:
EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */ EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */
EDA_ITEM* m_Son; /* Linked list: Link (son struct) */ EDA_ITEM* m_Son; /* Linked list: Link (son struct) */
unsigned long m_TimeStamp; ///< Time stamp used for logical links time_t m_TimeStamp; ///< Time stamp used for logical links
/// Set to true to override the visibility setting of the item. /// Set to true to override the visibility setting of the item.
bool m_forceVisible; bool m_forceVisible;
@ -430,8 +430,8 @@ public:
*/ */
KICAD_T Type() const { return m_StructType; } KICAD_T Type() const { return m_StructType; }
void SetTimeStamp( unsigned long aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; } void SetTimeStamp( time_t aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
unsigned long GetTimeStamp() const { return m_TimeStamp; } time_t GetTimeStamp() const { return m_TimeStamp; }
EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; } EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; }
EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; } EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; }

View File

@ -68,7 +68,7 @@ protected:
EDA_RECT m_RefBox; EDA_RECT m_RefBox;
/// The time at which the collection was made. /// The time at which the collection was made.
int m_TimeAtCollection; time_t m_TimeAtCollection;
public: public:
@ -205,7 +205,7 @@ public:
} }
int GetTime() time_t GetTime()
{ {
return m_TimeAtCollection; return m_TimeAtCollection;
} }
@ -229,7 +229,7 @@ public:
bool IsSimilarPointAndTime( const wxPoint& aRefPos ) bool IsSimilarPointAndTime( const wxPoint& aRefPos )
{ {
const int distMax = 2; // adjust these here const int distMax = 2; // adjust these here
const int timeMax = 3; // seconds, I think const time_t timeMax = 3; // seconds
int dx = abs( aRefPos.x - m_RefPos.x ); int dx = abs( aRefPos.x - m_RefPos.x );
int dy = abs( aRefPos.y - m_RefPos.y ); int dy = abs( aRefPos.y - m_RefPos.y );

View File

@ -572,7 +572,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info );
/** /**
* @return an unique time stamp that changes after each call * @return an unique time stamp that changes after each call
*/ */
unsigned long GetNewTimeStamp(); time_t GetNewTimeStamp();
int DisplayColorFrame( wxWindow* parent, int OldColor ); int DisplayColorFrame( wxWindow* parent, int OldColor );
int GetCommandOptions( const int argc, const char** argv, int GetCommandOptions( const int argc, const char** argv,

View File

@ -1202,7 +1202,7 @@ public:
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == * @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
* NULL * NULL
*/ */
void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 ); void Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp = 0 );
/** /**
* Function Delete_LastCreatedCorner * Function Delete_LastCreatedCorner

View File

@ -153,7 +153,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
/* Remove redundancies: sometime, zones are found twice, /* Remove redundancies: sometime, zones are found twice,
* because zones can be filled by overlapping segments (this is a fill option) * because zones can be filled by overlapping segments (this is a fill option)
*/ */
unsigned long timestampzone = 0; time_t timestampzone = 0;
for( int ii = 0; ii < m_Collector->GetCount(); ii++ ) for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
{ {

View File

@ -930,7 +930,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
int layer = intParse( data, &data ); int layer = intParse( data, &data );
long edittime = hexParse( data, &data ); long edittime = hexParse( data, &data );
long timestamp = hexParse( data, &data ); time_t timestamp = hexParse( data, &data );
data = strtok( (char*) data+1, delims ); data = strtok( (char*) data+1, delims );
@ -957,7 +957,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
else if( TESTLINE( "Sc" ) ) // timestamp else if( TESTLINE( "Sc" ) ) // timestamp
{ {
long timestamp = hexParse( line + SZ( "Sc" ) ); time_t timestamp = hexParse( line + SZ( "Sc" ) );
module->SetTimeStamp( timestamp ); module->SetTimeStamp( timestamp );
} }
@ -1676,7 +1676,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
dseg->SetAngle( angle ); // m_Angle dseg->SetAngle( angle ); // m_Angle
break; break;
case 3: case 3:
long timestamp; time_t timestamp;
timestamp = hexParse( data ); timestamp = hexParse( data );
dseg->SetTimeStamp( timestamp ); dseg->SetTimeStamp( timestamp );
break; break;
@ -1841,7 +1841,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
int layer = intParse( line + SZ( "De" ), &data ); int layer = intParse( line + SZ( "De" ), &data );
int notMirrored = intParse( data, &data ); int notMirrored = intParse( data, &data );
long timestamp = hexParse( data, &data ); time_t timestamp = hexParse( data, &data );
char* style = strtok( (char*) data, delims ); char* style = strtok( (char*) data, delims );
char* hJustify = strtok( NULL, delims ); char* hJustify = strtok( NULL, delims );
@ -1940,7 +1940,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
#endif #endif
int makeType; int makeType;
long timeStamp; time_t timeStamp;
int layer, type, flags, net_code; int layer, type, flags, net_code;
// parse the 2nd line to determine the type of object // parse the 2nd line to determine the type of object
@ -2132,7 +2132,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
else if( TESTLINE( "ZInfo" ) ) // general info found else if( TESTLINE( "ZInfo" ) ) // general info found
{ {
// e.g. 'ZInfo 479194B1 310 "COMMON"' // e.g. 'ZInfo 479194B1 310 "COMMON"'
long timestamp = hexParse( line + SZ( "ZInfo" ), &data ); time_t timestamp = hexParse( line + SZ( "ZInfo" ), &data );
int netcode = intParse( data, &data ); int netcode = intParse( data, &data );
if( ReadDelimitedText( buf, data, sizeof(buf) ) > (int) sizeof(buf) ) if( ReadDelimitedText( buf, data, sizeof(buf) ) > (int) sizeof(buf) )
@ -2348,7 +2348,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
else if( TESTLINE( "Ge" ) ) else if( TESTLINE( "Ge" ) )
{ {
int layer; int layer;
long timestamp; time_t timestamp;
int shape; int shape;
sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &layer, &timestamp ); sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &layer, &timestamp );
@ -2542,7 +2542,7 @@ void LEGACY_PLUGIN::loadPCB_TARGET()
BIU pos_y = biuParse( data, &data ); BIU pos_y = biuParse( data, &data );
BIU size = biuParse( data, &data ); BIU size = biuParse( data, &data );
BIU width = biuParse( data, &data ); BIU width = biuParse( data, &data );
long timestamp = hexParse( data ); time_t timestamp = hexParse( data );
if( layer < FIRST_NO_COPPER_LAYER ) if( layer < FIRST_NO_COPPER_LAYER )
layer = FIRST_NO_COPPER_LAYER; layer = FIRST_NO_COPPER_LAYER;

View File

@ -78,6 +78,7 @@ public:
wxString m_Footprint; // the footprint name found in netlist, the in .cmp file wxString m_Footprint; // the footprint name found in netlist, the in .cmp file
wxString m_Reference; // the schematic reference found in netlist wxString m_Reference; // the schematic reference found in netlist
wxString m_Value; // the schematic value found in netlist wxString m_Value; // the schematic value found in netlist
// ZZZ This timestamp is string, not time_t
wxString m_TimeStamp; // the schematic full time stamp found in netlist wxString m_TimeStamp; // the schematic full time stamp found in netlist
wxString m_Libpart; // the schematic libpart found in netlist wxString m_Libpart; // the schematic libpart found in netlist
wxArrayString m_FootprintFilter; // a footprint filters list found in old format netlist wxArrayString m_FootprintFilter; // a footprint filters list found in old format netlist

View File

@ -53,10 +53,10 @@
* @param aZone = zone segment within the zone to delete. Can be NULL * @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL * @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/ */
void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp ) void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp )
{ {
bool modify = false; bool modify = false;
unsigned long TimeStamp; time_t TimeStamp;
if( aZone == NULL ) if( aZone == NULL )
TimeStamp = aTimestamp; TimeStamp = aTimestamp;