← Back to team overview

kicad-developers team mailing list archive

Re: various patches

 

----- Original Message -----

> From: Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
> To: kicad-developers@xxxxxxxxxxxxxxxxxxx
> Cc: 
> Sent: Friday, January 3, 2014 7:07 AM
> Subject: Re: [Kicad-developers] various patches
> 
> On 1/1/2014 10:27 PM, Cirilo Bernardo wrote:
>>  Hi folks,
>> 
>>   I have put two sets of patches onto github for anyone to review or apply.
>> 
>>  The (bzr) patches:
>>    export_idf3.patch :  Adds basic IDF3 export (board and cutouts / holes 
> only)
>> 
>>    export_vrml.patch : Improved VRML export; includes more realistic 
> coloring scheme, zone fills, improved eye candy. This patch is better than the 
> patch I previously posted here; this patch fixes a number of bugs, eliminates a 
> redundant class, and provides features such as the zone fills and silver pads.
>> 
>>  URL: https://github.com/cbernardo/kicad-patches
>> 
>>  The patches are against Rev 4598.
>> 
>>  I would appreciate any comments on the patches.  Personally I would like to 
> see the patches incorporated with the bzr source. The vrml patch includes a 
> major rewrite of export_vrml.cpp and I'm confident users will find the 
> results to their liking.
>> 
>>  - Cirilo
>> 
> 
> Cirilo,
> 
> Your IDF3 patch fails to build on MinGW (runtime version 3.20, w32api
> version 3.17, and gcc version 4.7.2) due to undefined reference to
> localtime_r().  I suggest that you use wxDateTime to build your header
> time stamp instead of the the time_t and tm structures.  This should
> ensure that your code works on all platforms.
> 
> Thanks,
> 
> Wayne
> 
> 


Thanks Wayne,

 I've put in wxDateTime and tested; the patch is attached. (this patch also fixes a spelling error)

 Thanks for the tip; I'll keep that in mind when dealing with dates and times in KiCad.

 I have a work computer set up with MSWin (64 bit); any tips on what version of MinGW/MSys to install? I may as well set up so I can test my work on MinGW as well.

- Cirilo
=== modified file 'pcbnew/idf.cpp'
--- pcbnew/idf.cpp	2014-01-02 09:26:03 +0000
+++ pcbnew/idf.cpp	2014-01-02 21:07:14 +0000
@@ -492,30 +492,24 @@
         return false;
     }
 
-
-    time_t date;
-    time( &date );
-    struct tm tdate;
-
-    time( &date );
-    localtime_r( &date, &tdate );
+    wxDateTime tdate( time( NULL ) );
 
     fprintf( layoutFile, ".HEADER\n"
                          "BOARD_FILE 3.0 \"Created by KiCad %s\""
-                         " %.4d/%.2d/%.2d.%.2d:%.2d:%.2d 1\n"
+                         " %.4u/%.2u/%.2u.%.2u:%.2u:%.2u 1\n"
                          "\"%s\" %s\n"
                          ".END_HEADER\n\n",
             TO_UTF8( GetBuildVersion() ),
-            tdate.tm_year + 1900, tdate.tm_mon + 1, tdate.tm_mday,
-            tdate.tm_hour, tdate.tm_min, tdate.tm_sec,
+            tdate.GetYear(), tdate.GetMonth() + 1, tdate.GetDay(),
+            tdate.GetHour(), tdate.GetMinute(), tdate.GetSecond(),
             TO_UTF8( brdname.GetFullName() ), useThou ? "THOU" : "MM" );
 
     fprintf( libFile, ".HEADER\n"
                       "BOARD_FILE 3.0 \"Created by KiCad %s\" %.4d/%.2d/%.2d.%.2d:%.2d:%.2d 1\n"
                       ".END_HEADER\n\n",
             TO_UTF8( GetBuildVersion() ),
-            tdate.tm_year + 1900, tdate.tm_mon + 1, tdate.tm_mday,
-            tdate.tm_hour, tdate.tm_min, tdate.tm_sec );
+            tdate.GetYear(), tdate.GetMonth() + 1, tdate.GetDay(),
+            tdate.GetHour(), tdate.GetMinute(), tdate.GetSecond() );
 
     return true;
 }

=== modified file 'pcbnew/menubar_pcbframe.cpp'
--- pcbnew/menubar_pcbframe.cpp	2014-01-02 09:26:03 +0000
+++ pcbnew/menubar_pcbframe.cpp	2014-01-02 21:06:00 +0000
@@ -206,7 +206,7 @@
 
     // IDF3
     AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_IDF3,
-                 _( "I&DFv3 Board Shape Export" ), _( "Basci export of board shape only IDFv3 format" ),
+                 _( "I&DFv3 Board Shape Export" ), _( "Basic export of board shape only IDFv3 format" ),
                  KiBitmap( export_xpm ) );
 
     AddMenuItem( filesMenu, submenuexport,


References