Changeset 494
- Timestamp:
- 01/09/11 19:52:07 (14 years ago)
- Files:
-
- trunk/src/core/time.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/core/time.d
r483 r494 24 24 +/ 25 25 module core.time; 26 26 27 27 import core.exception; 28 28 import core.stdc.time; 29 29 import core.stdc.stdio; 30 30 31 31 version(Windows) 32 32 { 33 33 import core.sys.windows.windows; 34 import std.windows.syserror;35 34 } 36 35 else version(Posix) 37 36 { 38 37 import core.sys.posix.time; 39 38 import core.sys.posix.sys.time; 40 39 } 41 40 42 41 //This probably should be moved somewhere else in druntime which 43 42 //is OSX-specific. 44 43 //It's also totally untested, since I don't a have a Mac. … … 1826 1825 TimeException if it fails to get the time. 1827 1826 +/ 1828 1827 @trusted 1829 1828 static @property TickDuration currSystemTick() 1830 1829 { 1831 1830 version(Windows) 1832 1831 { 1833 1832 ulong ticks; 1834 1833 1835 1834 if(QueryPerformanceCounter(cast(long*)&ticks) == 0) 1836 throw new TimeException(sysErrorString(GetLastError())); 1835 // This probably cannot happen on Windows 95 or later 1836 throw new TimeException("Failed in QueryPerformanceCounter()."); 1837 1837 1838 1838 return TickDuration(ticks); 1839 1839 } 1840 1840 else version(OSX) 1841 1841 { 1842 1842 static if(is(typeof(mach_absolute_time))) 1843 1843 return TickDuration(cast(long)mach_absolute_time()); 1844 1844 else 1845 1845 { 1846 1846 timeval tv;
