tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

Implement time.NewTimer and time.NewTicker

Open aykevl opened this issue 3 years ago • 4 comments

This has been requested before in #1037 and it is necessary for using the stdlib testing package. I have compared the code size before and after and except for very nontrivial cases the code size is the same (even with the scheduler additions). All examples in the drivers repo remain the same.

aykevl avatar Sep 22 '20 18:09 aykevl

When asyncify lands might be a good time to revisit this...?

dkegel-fastly avatar Nov 09 '21 21:11 dkegel-fastly

When asyncify lands might be a good time to revisit this...?

@dkegel-fastly that is a very good question. @aykevl what do you think?

deadprogram avatar Dec 06 '21 09:12 deadprogram

@aykevl Any progress on this?

Implementing time.startTimer may result in some of the following tests being ok https://tinygo.org/docs/reference/lang-support/stdlib/

  • bufio
  • compress/gzip
  • encoding/base64
  • go/printer
  • image/jpeg
  • io
  • mime/quotedprintable

It would also be nice to be able to use time.After, time.Tick, etc.

sago35 avatar Jul 22 '22 09:07 sago35

@sago35 my port of @aykevl code seems to be working well to me. It's pretty much Ayke's code, so not sure if he wants to take it forward. If not, I think my PR is ready to review: https://github.com/tinygo-org/tinygo/pull/2954

kenbell avatar Jul 22 '22 09:07 kenbell

Closing in favor of #2954

aykevl avatar Aug 20 '22 14:08 aykevl