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;
unsigned long newTimeStamp;
static time_t oldTimeStamp;
time_t newTimeStamp;
newTimeStamp = time( NULL );

View File

@ -91,6 +91,7 @@ class CMP_LIBRARY
{
int type; ///< Library type indicator.
wxFileName fileName; ///< Library file name.
// ZZZ why this a wxDateTime where others are time_t?
wxDateTime timeStamp; ///< Library save time and date.
int versionMajor; ///< Library major 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.
bool m_IsNew; ///< True if not yet annotated.
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
///< same for all instances.
int m_NumRef; ///< The numeric part of the reference designator.

View File

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

View File

@ -400,7 +400,7 @@ protected:
EDA_ITEM* m_Parent; /* Linked list: Link (parent 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.
bool m_forceVisible;
@ -430,8 +430,8 @@ public:
*/
KICAD_T Type() const { return m_StructType; }
void SetTimeStamp( unsigned long aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
unsigned long GetTimeStamp() const { return m_TimeStamp; }
void SetTimeStamp( time_t aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
time_t GetTimeStamp() const { return m_TimeStamp; }
EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; }
EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; }

View File

@ -68,7 +68,7 @@ protected:
EDA_RECT m_RefBox;
/// The time at which the collection was made.
int m_TimeAtCollection;
time_t m_TimeAtCollection;
public:
@ -205,7 +205,7 @@ public:
}
int GetTime()
time_t GetTime()
{
return m_TimeAtCollection;
}
@ -229,7 +229,7 @@ public:
bool IsSimilarPointAndTime( const wxPoint& aRefPos )
{
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 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
*/
unsigned long GetNewTimeStamp();
time_t GetNewTimeStamp();
int DisplayColorFrame( wxWindow* parent, int OldColor );
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 ==
* NULL
*/
void Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp = 0 );
void Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp = 0 );
/**
* Function Delete_LastCreatedCorner

View File

@ -153,7 +153,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
/* Remove redundancies: sometime, zones are found twice,
* 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++ )
{

View File

@ -930,7 +930,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
int layer = intParse( data, &data );
long edittime = hexParse( data, &data );
long timestamp = hexParse( data, &data );
time_t timestamp = hexParse( data, &data );
data = strtok( (char*) data+1, delims );
@ -957,7 +957,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE()
else if( TESTLINE( "Sc" ) ) // timestamp
{
long timestamp = hexParse( line + SZ( "Sc" ) );
time_t timestamp = hexParse( line + SZ( "Sc" ) );
module->SetTimeStamp( timestamp );
}
@ -1676,7 +1676,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
dseg->SetAngle( angle ); // m_Angle
break;
case 3:
long timestamp;
time_t timestamp;
timestamp = hexParse( data );
dseg->SetTimeStamp( timestamp );
break;
@ -1841,7 +1841,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
int layer = intParse( line + SZ( "De" ), &data );
int notMirrored = intParse( data, &data );
long timestamp = hexParse( data, &data );
time_t timestamp = hexParse( data, &data );
char* style = strtok( (char*) data, delims );
char* hJustify = strtok( NULL, delims );
@ -1940,7 +1940,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType )
#endif
int makeType;
long timeStamp;
time_t timeStamp;
int layer, type, flags, net_code;
// 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
{
// 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 );
if( ReadDelimitedText( buf, data, sizeof(buf) ) > (int) sizeof(buf) )
@ -2348,7 +2348,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
else if( TESTLINE( "Ge" ) )
{
int layer;
long timestamp;
time_t timestamp;
int shape;
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 size = biuParse( data, &data );
BIU width = biuParse( data, &data );
long timestamp = hexParse( data );
time_t timestamp = hexParse( data );
if( 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_Reference; // the schematic reference 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_Libpart; // the schematic libpart found in 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 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;
unsigned long TimeStamp;
time_t TimeStamp;
if( aZone == NULL )
TimeStamp = aTimestamp;