← Back to team overview

kicad-developers team mailing list archive

Re: Python: time_t needs mapping; tentative patch

 

Hi!

On 2017-11-28 10:10, Henner Zeller wrote:
>>>> IIRC the timestamp is just an unique ID of the item in Kicad, right?
>>>> It's never propagated to the system time, so 64-bits IMHO 64-bits should
>>>> be safe everywhere.

Fine, as long as there is an agreement that Kicad's uint64_t timestamp is holding the number of seconds (not counting leap seconds) since 00:00, Jan 1 1970 UTC, corresponding to POSIX time - on all platforms?

As of the time of writing this on my 64bit Arch Linux, this:
----- 8< -----
#include <stdio.h>
#include <time.h>
#include <inttypes.h>
int main(void) {
	time_t timestamp;
	time(&timestamp);
	printf("time_t [PRIu64]: %" PRIu64 "\n", timestamp);
	printf("time_t [PRIx64]: %" PRIx64 "\n", timestamp);
	printf("sizeof(time_t): %d\n", sizeof(time_t));
	return 0;
}
----- 8< -----

delivers:

----- 8< -----
time_t [PRIu64]: 1511871892
time_t [PRIx64]: 5a1d5594
sizeof(time_t): 8
----- 8< -----

Correct?

Regards,

Clemens

On 2017-11-28 10:10, Henner Zeller wrote:
>>>> IIRC the timestamp is just an unique ID of the item in Kicad, right?
>>>> It's never propagated to the system time, so 64-bits IMHO 64-bits should
>>>> be safe everywhere.
>>>>
>>>> Tom
>>>
>>> Yes it is a unique ID only.
>>> It is converted to a date in footprint editor (legacy mode) to show the last edition date to the user.
>>> This is easy to convert a uint64_t to show this message.
>>
>> I suppose the most elegant solution would be to change time_t in KiCad
>> source code to uint64_t. This leaves no ambiguity and should be easy to
>> handle with swig.
> 
> This sounds good to me, in particular as it reflects more the use of
> what this is (a unique ID instead of a timestamp).
> 
> -h
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References