~eliasnaur/gio

4 3

different types of pointer.Event.Time and system.FrameEvent.Now ?

Details
Message ID
<CA+ctqrp6LPFT=5Ajaft2Q-o7fWdibeEry8EE92SPa+7X8PVkZA@mail.gmail.com>
DKIM signature
missing
Download raw message
Is there a specific design reason why the 2 events' timestamps are
stored as different types?

https://pkg.go.dev/gioui.org/io/pointer#Event
Time time.Duration

https://pkg.go.dev/gioui.org/io/system#FrameEvent
Now time.Time

thanks!
Details
Message ID
<CAFcc3FTnF_uXms7ByxP==HGY8-v0GsGAht1FU8n0H-=eER-Myw@mail.gmail.com>
In-Reply-To
<CA+ctqrp6LPFT=5Ajaft2Q-o7fWdibeEry8EE92SPa+7X8PVkZA@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Wed, Oct 25, 2023 at 5:35 AM <fgergo@gmail.com> wrote:
>
> Is there a specific design reason why the 2 events' timestamps are
> stored as different types?

I honestly don't know. Elias?

Cheers,
Chris
Details
Message ID
<CAMAFT9VdTK=57gyiP+qR0TJK515UnCYpgfrZCwkMOOzhwjXvEw@mail.gmail.com>
In-Reply-To
<CAFcc3FTnF_uXms7ByxP==HGY8-v0GsGAht1FU8n0H-=eER-Myw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Fri, 27 Oct 2023 at 11:40, Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
>
> On Wed, Oct 25, 2023 at 5:35 AM <fgergo@gmail.com> wrote:
> >
> > Is there a specific design reason why the 2 events' timestamps are
> > stored as different types?
>
> I honestly don't know. Elias?
>

The idea is that we can't guarantee an absolute timestamp for events.
Representing
event time as a time.Duration allows us to leave the time reference undefined.

FrameEvent.Now is just (1) a time.Now cache and (2) a way to eliminate time skew
across a frame.

Elias
Details
Message ID
<CA+ctqrraDLLyONwUnyEZrttk3iufR8BmURhVVOD9U_rt4QfcVw@mail.gmail.com>
In-Reply-To
<CAMAFT9VdTK=57gyiP+qR0TJK515UnCYpgfrZCwkMOOzhwjXvEw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On 10/27/23, Elias Naur <mail@eliasnaur.com> wrote:
> On Fri, 27 Oct 2023 at 11:40, Chris Waldon
> <christopher.waldon.dev@gmail.com> wrote:
>>
>> On Wed, Oct 25, 2023 at 5:35 AM <fgergo@gmail.com> wrote:
>> >
>> > Is there a specific design reason why the 2 events' timestamps are
>> > stored as different types?
>>
>> I honestly don't know. Elias?
>>
>
> The idea is that we can't guarantee an absolute timestamp for events.
Thanks!

> Representing event time as a time.Duration allows us to leave the time reference
> undefined.
>
> FrameEvent.Now is just (1) a time.Now cache and (2) a way to eliminate time
> skew across a frame.
Do you mean a "... way for gio based programs to eleminate time skew
while building a frame."
Iiuc gio does not need to propagate this cached value to function properly?

Iiu FrameEvent.Now could have been a (calculated) time.Duration type
as well. Please note: I don't want to change anything, I'd just like
to understand, because I plan to use timing details.

Thanks again!
Details
Message ID
<CAMAFT9W6wBTfqgQXZ=z=Hn2zheKctqPFMFPbj20DQ2Q9igW20A@mail.gmail.com>
In-Reply-To
<CA+ctqrraDLLyONwUnyEZrttk3iufR8BmURhVVOD9U_rt4QfcVw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sat, 28 Oct 2023 at 05:23, <fgergo@gmail.com> wrote:
>
> On 10/27/23, Elias Naur <mail@eliasnaur.com> wrote:
> > On Fri, 27 Oct 2023 at 11:40, Chris Waldon
> > <christopher.waldon.dev@gmail.com> wrote:
> >>
> >> On Wed, Oct 25, 2023 at 5:35 AM <fgergo@gmail.com> wrote:
> >> >
> >> > Is there a specific design reason why the 2 events' timestamps are
> >> > stored as different types?
> >>
> >> I honestly don't know. Elias?
> >>
> >
> > The idea is that we can't guarantee an absolute timestamp for events.
> Thanks!
>
> > Representing event time as a time.Duration allows us to leave the time reference
> > undefined.
> >
> > FrameEvent.Now is just (1) a time.Now cache and (2) a way to eliminate time
> > skew across a frame.
> Do you mean a "... way for gio based programs to eleminate time skew
> while building a frame."

Yes.

> Iiuc gio does not need to propagate this cached value to function properly?
>

In a sense, yes, it's for the service of Gio programs to eliminate the (rare)
animation skew that may happen if components query time.Now independently.

> Iiu FrameEvent.Now could have been a (calculated) time.Duration type
> as well. Please note: I don't want to change anything, I'd just like
> to understand, because I plan to use timing details.
>

FrameEvent.Now could be a time.Duration. However, I worry that it would
then be expected to be compatible with pointer.Event.Time.

Elias
Reply to thread Export thread (mbox)