Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-12 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we can change that and choose the precision. Does anyone know

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/21 5:13 PM, rempas wrote: On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-10 Thread Ali Çehreli via Digitalmars-d-learn
On 7/9/21 11:28 PM, rempas wrote: > So it's an OS thing? Don't listen to me on this. :) A quick search yesterday made me believe you need kernel support as well. Even if so, I would imagine modern kernel on modern hardware should work. Ali

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-10 Thread Bruce Carneal via Digitalmars-d-learn
On Saturday, 10 July 2021 at 01:11:28 UTC, Steven Schveighoffer wrote: You can get better than hnsecs resolution with `core.time.MonoTime`, which can support whatever the OS supports. However, `Duration` and `SysTime` are stored in hnsecs for a very specific reason -- range. Simply put,

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-10 Thread rempas via Digitalmars-d-learn
On Friday, 9 July 2021 at 21:04:42 UTC, Ali Çehreli wrote: On 7/9/21 1:54 PM, Paul Backus wrote: [...] Yes but the resolution seems not to be better than 100 nsecs. A quick research reveals a better resolution is not possible with common hardware on at least Linux. The following program

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/21 5:04 PM, Ali Çehreli wrote: On 7/9/21 1:54 PM, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 9 July 2021 at 21:13:02 UTC, rempas wrote: On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread jfondren via Digitalmars-d-learn
On Friday, 9 July 2021 at 21:13:02 UTC, rempas wrote: ``` Duration dur = end - start; dur = dur.total!"nsecs"; ``` What are you trying to do, assigning a nanosecond value to a Duration? The Duration already has that many nanoseconds in it. and I get the following error message: "Error:

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread rempas via Digitalmars-d-learn
On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread Ali Çehreli via Digitalmars-d-learn
On 7/9/21 1:54 PM, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we can change that and

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread Paul Backus via Digitalmars-d-learn
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we can change that and choose the precision. Does anyone know

Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread rempas via Digitalmars-d-learn
I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we can change that and choose the precision. Does anyone know if we can do that?