Change time_t in the functions that deal with timestamps to a new typedef timestamp_t (defined as a long).
that makes sure the c++ side and swigged Python side agree on the type, because time_t create problems in Python scripts.
This commit is contained in:
parent
a63e9b863b
commit
3f57fa5d24
|
@ -163,10 +163,10 @@ int ProcessExecute( const wxString& aCommandLine, int aFlags, wxProcess *callbac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t GetNewTimeStamp()
|
timestamp_t GetNewTimeStamp()
|
||||||
{
|
{
|
||||||
static time_t oldTimeStamp;
|
static timestamp_t oldTimeStamp;
|
||||||
time_t newTimeStamp;
|
timestamp_t newTimeStamp;
|
||||||
|
|
||||||
newTimeStamp = time( NULL );
|
newTimeStamp = time( NULL );
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
|
||||||
unsigned long timeStamp = (unsigned long)GetNewTimeStamp();
|
unsigned long timeStamp = (unsigned long)GetNewTimeStamp();
|
||||||
|
|
||||||
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), timeStamp ) );
|
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), timeStamp ) );
|
||||||
sheet->SetTimeStamp( (time_t)timeStamp );
|
sheet->SetTimeStamp( (timestamp_t)timeStamp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -613,7 +613,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
||||||
wxCHECK2_MSG( renamedSheet, continue,
|
wxCHECK2_MSG( renamedSheet, continue,
|
||||||
"Sheet " + duplicateName + " not found in imported schematic." );
|
"Sheet " + duplicateName + " not found in imported schematic." );
|
||||||
|
|
||||||
time_t newtimestamp = GetNewTimeStamp();
|
timestamp_t newtimestamp = GetNewTimeStamp();
|
||||||
renamedSheet->SetTimeStamp( newtimestamp );
|
renamedSheet->SetTimeStamp( newtimestamp );
|
||||||
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (long) newtimestamp ) );
|
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (long) newtimestamp ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,7 +706,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
|
void SCH_COMPONENT::SetTimeStamp( timestamp_t aNewTimeStamp )
|
||||||
{
|
{
|
||||||
wxString string_timestamp, string_oldtimestamp;
|
wxString string_timestamp, string_oldtimestamp;
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aNewTimeStamp = new time stamp
|
* @param aNewTimeStamp = new time stamp
|
||||||
*/
|
*/
|
||||||
void SetTimeStamp( time_t aNewTimeStamp );
|
void SetTimeStamp( timestamp_t aNewTimeStamp );
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ class SCH_REFERENCE
|
||||||
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.
|
||||||
time_t m_TimeStamp; ///< The time stamp for the reference.
|
timestamp_t m_TimeStamp; ///< The time stamp for the reference.
|
||||||
EDA_TEXT* m_Value; ///< The component value of the reference. It is the
|
EDA_TEXT* m_Value; ///< The component value of the reference. 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.
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include <bitmap_types.h>
|
#include <bitmap_types.h>
|
||||||
#include <view/view_item.h>
|
#include <view/view_item.h>
|
||||||
|
#include <common.h>
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#include <iostream> // needed for Show()
|
#include <iostream> // needed for Show()
|
||||||
|
@ -180,7 +181,7 @@ protected:
|
||||||
DHEAD* m_List; ///< which DLIST I am on.
|
DHEAD* m_List; ///< which DLIST I am on.
|
||||||
|
|
||||||
EDA_ITEM* m_Parent; ///< Linked list: Link (parent struct)
|
EDA_ITEM* m_Parent; ///< Linked list: Link (parent struct)
|
||||||
time_t m_TimeStamp; ///< Time stamp used for logical links
|
timestamp_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;
|
||||||
|
@ -214,8 +215,8 @@ public:
|
||||||
return m_StructType;
|
return m_StructType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTimeStamp( time_t aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
|
void SetTimeStamp( timestamp_t aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
|
||||||
time_t GetTimeStamp() const { return m_TimeStamp; }
|
timestamp_t GetTimeStamp() const { return m_TimeStamp; }
|
||||||
|
|
||||||
EDA_ITEM* Next() const { return Pnext; }
|
EDA_ITEM* Next() const { return Pnext; }
|
||||||
EDA_ITEM* Back() const { return Pback; }
|
EDA_ITEM* Back() const { return Pback; }
|
||||||
|
|
|
@ -222,10 +222,23 @@ int ProcessExecute( const wxString& aCommandLine, int aFlags = wxEXEC_ASYNC,
|
||||||
/* common.cpp */
|
/* common.cpp */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timestamp_t is our type to represent unique IDs for all kinds of elements;
|
||||||
|
* historically simply the timestamp when they were created.
|
||||||
|
*
|
||||||
|
* Long term, this type might be renamed to something like unique_id_t
|
||||||
|
* (and then rename all the methods from {Get,Set}TimeStamp()
|
||||||
|
* to {Get,Set}Id()) ?
|
||||||
|
*
|
||||||
|
* The type should be at least 32 bit and simple to map via swig; swig does
|
||||||
|
* have issues with types such as 'int32_t', so we choose 'long'.
|
||||||
|
*/
|
||||||
|
typedef long timestamp_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an unique time stamp that changes after each call
|
* @return an unique time stamp that changes after each call
|
||||||
*/
|
*/
|
||||||
time_t GetNewTimeStamp();
|
timestamp_t GetNewTimeStamp();
|
||||||
|
|
||||||
int GetCommandOptions( const int argc, const char** argv,
|
int GetCommandOptions( const int argc, const char** argv,
|
||||||
const char* stringtst, const char** optarg,
|
const char* stringtst, const char** optarg,
|
||||||
|
|
|
@ -544,8 +544,8 @@ public:
|
||||||
|
|
||||||
double GetArea() const { return m_Surface; }
|
double GetArea() const { return m_Surface; }
|
||||||
|
|
||||||
time_t GetLink() const { return m_Link; }
|
timestamp_t GetLink() const { return m_Link; }
|
||||||
void SetLink( time_t aLink ) { m_Link = aLink; }
|
void SetLink( timestamp_t aLink ) { m_Link = aLink; }
|
||||||
|
|
||||||
int GetPlacementCost180() const { return m_CntRot180; }
|
int GetPlacementCost180() const { return m_CntRot180; }
|
||||||
void SetPlacementCost180( int aCost ) { m_CntRot180 = aCost; }
|
void SetPlacementCost180( int aCost ) { m_CntRot180 = aCost; }
|
||||||
|
@ -711,7 +711,7 @@ private:
|
||||||
time_t m_LastEditTime;
|
time_t m_LastEditTime;
|
||||||
int m_arflag; ///< Use to trace ratsnest and auto routing.
|
int m_arflag; ///< Use to trace ratsnest and auto routing.
|
||||||
double m_Surface; ///< Bounding box area
|
double m_Surface; ///< Bounding box area
|
||||||
time_t m_Link; ///< Temporary logical link used in edition
|
timestamp_t m_Link; ///< Temporary logical link used in edition
|
||||||
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
|
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
|
||||||
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
|
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
* 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)
|
||||||
* Trigger the selection of the current edge for new-style zones
|
* Trigger the selection of the current edge for new-style zones
|
||||||
*/
|
*/
|
||||||
time_t timestampzone = 0;
|
timestamp_t timestampzone = 0;
|
||||||
|
|
||||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
|
||||||
PCB_LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num );
|
PCB_LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num );
|
||||||
|
|
||||||
long edittime = hexParse( data, &data );
|
long edittime = hexParse( data, &data );
|
||||||
time_t timestamp = hexParse( data, &data );
|
timestamp_t timestamp = hexParse( data, &data );
|
||||||
|
|
||||||
data = strtok_r( (char*) data+1, delims, &saveptr );
|
data = strtok_r( (char*) data+1, delims, &saveptr );
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
|
||||||
|
|
||||||
else if( TESTLINE( "Sc" ) ) // timestamp
|
else if( TESTLINE( "Sc" ) ) // timestamp
|
||||||
{
|
{
|
||||||
time_t timestamp = hexParse( line + SZ( "Sc" ) );
|
timestamp_t timestamp = hexParse( line + SZ( "Sc" ) );
|
||||||
aModule->SetTimeStamp( timestamp );
|
aModule->SetTimeStamp( timestamp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1984,7 +1984,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
|
||||||
dseg->SetAngle( angle ); // m_Angle
|
dseg->SetAngle( angle ); // m_Angle
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
time_t timestamp;
|
timestamp_t timestamp;
|
||||||
timestamp = hexParse( data );
|
timestamp = hexParse( data );
|
||||||
dseg->SetTimeStamp( timestamp );
|
dseg->SetTimeStamp( timestamp );
|
||||||
break;
|
break;
|
||||||
|
@ -2183,12 +2183,12 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
|
||||||
// e.g. "De 21 1 0 Normal C\r\n"
|
// e.g. "De 21 1 0 Normal C\r\n"
|
||||||
// sscanf( line + 2, " %d %d %lX %s %c\n", &m_Layer, &normal_display, &m_TimeStamp, style, &hJustify );
|
// sscanf( line + 2, " %d %d %lX %s %c\n", &m_Layer, &normal_display, &m_TimeStamp, style, &hJustify );
|
||||||
|
|
||||||
LAYER_NUM layer_num = layerParse( line + SZ( "De" ), &data );
|
LAYER_NUM layer_num = layerParse( line + SZ( "De" ), &data );
|
||||||
int notMirrored = intParse( data, &data );
|
int notMirrored = intParse( data, &data );
|
||||||
time_t timestamp = hexParse( data, &data );
|
timestamp_t timestamp = hexParse( data, &data );
|
||||||
char* style = strtok_r( (char*) data, delims, &saveptr );
|
char* style = strtok_r( (char*) data, delims, &saveptr );
|
||||||
char* hJustify = strtok_r( NULL, delims, &saveptr );
|
char* hJustify = strtok_r( NULL, delims, &saveptr );
|
||||||
char* vJustify = strtok_r( NULL, delims, &saveptr );
|
char* vJustify = strtok_r( NULL, delims, &saveptr );
|
||||||
|
|
||||||
pcbtxt->SetMirrored( !notMirrored );
|
pcbtxt->SetMirrored( !notMirrored );
|
||||||
pcbtxt->SetTimeStamp( timestamp );
|
pcbtxt->SetTimeStamp( timestamp );
|
||||||
|
@ -2319,7 +2319,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
newTrack->SetTimeStamp( (time_t)timeStamp );
|
newTrack->SetTimeStamp( (timestamp_t)timeStamp );
|
||||||
newTrack->SetPosition( wxPoint( start_x, start_y ) );
|
newTrack->SetPosition( wxPoint( start_x, start_y ) );
|
||||||
newTrack->SetEnd( wxPoint( end_x, end_y ) );
|
newTrack->SetEnd( wxPoint( end_x, end_y ) );
|
||||||
|
|
||||||
|
@ -2511,7 +2511,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"'
|
||||||
time_t timestamp = hexParse( line + SZ( "ZInfo" ), &data );
|
timestamp_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) )
|
||||||
|
@ -2784,7 +2784,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
|
||||||
layer_num = ilayer;
|
layer_num = ilayer;
|
||||||
|
|
||||||
dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) );
|
dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) );
|
||||||
dim->SetTimeStamp( (time_t) timestamp );
|
dim->SetTimeStamp( (timestamp_t) timestamp );
|
||||||
dim->SetShape( shape );
|
dim->SetShape( shape );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2960,7 +2960,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 );
|
||||||
time_t timestamp = hexParse( data );
|
timestamp_t timestamp = hexParse( data );
|
||||||
|
|
||||||
if( layer_num < FIRST_NON_COPPER_LAYER )
|
if( layer_num < FIRST_NON_COPPER_LAYER )
|
||||||
layer_num = FIRST_NON_COPPER_LAYER;
|
layer_num = FIRST_NON_COPPER_LAYER;
|
||||||
|
|
|
@ -183,7 +183,7 @@ static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
||||||
EDA_ITEM* pnext = aItem->Next();
|
EDA_ITEM* pnext = aItem->Next();
|
||||||
EDA_ITEM* pback = aItem->Back();
|
EDA_ITEM* pback = aItem->Back();
|
||||||
DHEAD* mylist = aItem->GetList();
|
DHEAD* mylist = aItem->GetList();
|
||||||
time_t timestamp = aItem->GetTimeStamp();
|
timestamp_t timestamp = aItem->GetTimeStamp();
|
||||||
EDA_ITEM* parent = aItem->GetParent();
|
EDA_ITEM* parent = aItem->GetParent();
|
||||||
|
|
||||||
aItem->SwapData( aImage );
|
aItem->SwapData( aImage );
|
||||||
|
|
|
@ -1372,7 +1372,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, time_t aTimestamp = 0 );
|
void Delete_OldZone_Fill( SEGZONE* aZone, timestamp_t aTimestamp = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Delete_LastCreatedCorner
|
* Function Delete_LastCreatedCorner
|
||||||
|
|
|
@ -59,10 +59,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, time_t aTimestamp )
|
void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, timestamp_t aTimestamp )
|
||||||
{
|
{
|
||||||
bool modify = false;
|
bool modify = false;
|
||||||
time_t TimeStamp;
|
timestamp_t TimeStamp;
|
||||||
|
|
||||||
if( aZone == NULL )
|
if( aZone == NULL )
|
||||||
TimeStamp = aTimestamp;
|
TimeStamp = aTimestamp;
|
||||||
|
|
Loading…
Reference in New Issue