https://d.puremagic.com/issues/show_bug.cgi?id=12067

           Summary: std.datetime.measureTime() has incomplete example, and
                    does not work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Walter Bright <[email protected]> 2014-02-02 
20:59:43 PST ---
Presumably the function http://dlang.org/phobos/std_datetime.html#.measureTime
is supposed to be for measuring the elapsed time of some code, i.e. for
benchmarking it. But:

1. The example given is a code fragment, the user is left to guess what else
might be needed to get it to work.

2. The user most likely wants to print the elapsed time. The example gives no
clue how to do that.

3. Guessing at what is needed to make a complete program, the program fails to
link:

-----------------------------
import std.datetime;
import std.stdio;

void main() {
  writeln("benchmark start!");
  {
  auto mt = measureTime!((a){assert(a.seconds);});
  doSomething();
  }
  writeln("benchmark end!");
}
------------------------------
C:\mars>\dmd2\windows\bin\dmd foo
OPTLINK (R) for Win32  Release 8.00.13
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
foo.obj(foo)
 Error 42: Symbol Undefined
_D3foo4mainFZv46__T14__funcliteral1TS4core4time12TickDurationZ14__funcli
teral1FS4core4time12TickDurationZv
--- errorlevel 1

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to