timestamp overflows sprinter interface

classic Classic list List threaded Threaded
3 messages Options
Peter Wang-2 Peter Wang-2
Reply | Threaded
Open this post in threaded view
|

timestamp overflows sprinter interface

Hi,

On a system where time_t is 64-bit and 'int' is a signed 32-bit integer
type, timestamps beyond some time in 2038 will be serialised to a
negative value.

The simplest solution appears to be to change the type in the sprinter
method to int64_t:

    void (*integer)(struct sprinter *, int64_t);

Any other suggestions?

Peter

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: timestamp overflows sprinter interface

Peter Wang <[hidden email]> writes:

> Hi,
>
> On a system where time_t is 64-bit and 'int' is a signed 32-bit integer
> type, timestamps beyond some time in 2038 will be serialised to a
> negative value.

I admire your forward thinking!

>
> The simplest solution appears to be to change the type in the sprinter
> method to int64_t:
>
>     void (*integer)(struct sprinter *, int64_t);
>
> Any other suggestions?

Since this is an internal API, I don't really see a big problem with
doing this.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Peter Wang-2 Peter Wang-2
Reply | Threaded
Open this post in threaded view
|

Re: timestamp overflows sprinter interface

On Mon, 03 Feb 2020 09:40:49 -0400, David Bremner <[hidden email]> wrote:
> Peter Wang <[hidden email]> writes:
>
> > Hi,
> >
> > On a system where time_t is 64-bit and 'int' is a signed 32-bit integer
> > type, timestamps beyond some time in 2038 will be serialised to a
> > negative value.
>
> I admire your forward thinking!

Nah, someone reported an issue with my mail client when viewing a
message dated 09 Dec 2058.

>
> >
> > The simplest solution appears to be to change the type in the sprinter
> > method to int64_t:
> >
> >     void (*integer)(struct sprinter *, int64_t);
> >
> > Any other suggestions?
>
> Since this is an internal API, I don't really see a big problem with
> doing this.

I've sent a patch.

Peter
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch