Floydlang / floyd

The Floyd programming language
MIT License
150 stars 13 forks source link

get_time_of_day() always returns zero #10

Open lemonad opened 5 years ago

lemonad commented 5 years ago
print(get_time_of_day())

always prints out zero on my machine (2017 Macbook Pro 13" with High Sierra installed).

marcusz commented 5 years ago

Hmm. Name and implementation don't match. It returns the number of milliseconds since start of application. It's one of the first host functions ever implemented, maybe rethink this API completely. Ideas?

lemonad commented 5 years ago

Then the return value of zero makes sense : ) Would all of this be real-time time or do you have virtual time too?

I know that there are a ton of pitfalls around computer time, time (and time zones!) but know far too little about the details to even know where to start. Especially lower level stuff since processes can be suspended and wake up to completely other times, clocks can be sped up/slowed down to adjust to leap seconds and daylight saving times.

Personally, at this point, I just need a seed for pseudorandom numbers so some variant of get_current_time in unix time (seconds or milliseconds) would go a long way for me.

marcusz commented 5 years ago

Will deprecated this function, introduce better replacements.