NOTE: This is a different bug from issue 15501, despite similar title. $dmd_069_X -version=A -c -o- main.d ok dmd -version=A -c -o- main.d Deprecation: function std.datetime.Clock.currSystemTick is deprecated - Use core.time.MonoTime.currTime instead so after applying the recommended fix (version(B)): dmd -version=B -c -o- main.d Error: no property 'nsecs' for type 'MonoTimeImpl!cast(ClockType)0' ---- void test() { version(A){ import std.datetime; auto temp=Clock.currSystemTick().nsecs() * 1e-9; } version(B){ static import core.time; auto temp=core.time.MonoTime.currTime.nsecs * 1e-9; } } ----
EDIT: i forgot to add 'import std.datetime;' inside version(B): dmd -version=B -c -o- main.d Error: function core.time.dur!"nsecs".dur (long length) is not callable using argument types (MonoTimeImpl!cast(ClockType)0) --- void test() { version(A){ import std.datetime; auto temp=Clock.currSystemTick().nsecs() * 1e-9; } version(B){ import std.datetime; static import core.time; auto temp=core.time.MonoTime.currTime.nsecs * 1e-9; } } ---
so the following works: core.time.MonoTime.currTime.ticks.nsecs.total!"nsecs" therefore the deprecation message should be reflecting one to use that instead (or link to some explanation or this bug) instead of: 'Deprecation: function std.datetime.Clock.currSystemTick is deprecated - Use core.time.MonoTime.currTime instead'
I confess that I don't understand what you're trying to do. core.time.MonoTime.currTime.ticks.nsecs.total!"nsecs" makes no sense at all. And doing the same thing with TickDuration would have been just as broken. currSystemTick returns the current tick of the system's monotonic clock as a TickDuration. It is _not_ a duration but a point in time (which is part of why TickDuration is being phased out - it's used both as a duration and a time point). So, converting it to nanoseconds is meaningless. And converting MonoTime to nanoseconds is just as meaningless. It would be like trying to convert 2016-01-04T12:00:07 to nanoseconds, only 2016-01-04T12:00:07 is the wall clock time not the time from the monotonic clock (which is just in ticks). Please read the documentation for MonoTime. Based on what you're trying to do here, you do not appear to understand either TickDuration or MonoTime.