On 2/6/2017 1:33 PM, Anatol Belski wrote:
> With the names and API, probably some more clarity should be. AFM,
> the low level units should be exposed, rather than a concrete time.
> Also, the name hrtime() is probably not much speaking. Maybe these
> three?
> 
> sys_get_monotonic_ticks()
> sys_get_monotonic_freq() 
> sys_get_monotonic_nanotime() or even -
> sys_get_monotonic_time(int $unit = NANOSECOND)
> 
> Regarding to "sys_get_*" scheme with these. But in general, probably
> nanoseconds were enough for the general case and fast, the pure ticks
> were for the advanced usage.
> 
> In general, probably for the core it should be done a more robust
> way, some parts on the original lib should get more error checks and
> improved. It would be probably more handy to discuss the further on
> the PR page.
> 
> Regards
> 
> Anatol
> 

Hey guys! :)

Please do not introduce more functions that require flags, it makes code
hard to read. It's much better to have dedicated functions that provide
exactly what is requested. A good bad example is `microtime()` vs
`microtime(true)`. :(

`sys_get_monotonic_nanotime()` is rather long but at least descriptive.
Obviously providing a class could help with naming a lot and future
extension would be easy, e.g. `MonotonicTime::getNanoseconds()`.

-- 
Richard "Fleshgrinder" Fussenegger

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to