[Issue 8411] New: core.time: No easy way to check if Duration is empty

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 22 06:46:40 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8411

           Summary: core.time: No easy way to check if Duration is empty
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2012-07-22 06:46:38 PDT ---
The simplest way to check for an empty Duration seems to be:

if (!duration.total!"hnsecs"()) { ... }

I suggest either implementing an isEmpty property (given that there already is
an isNegative property), or implement opCast!bool so that the following will
work:

if (!duration) { ... }

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


More information about the Digitalmars-d-bugs mailing list