From 909f7dbf8cac95d4cdb08c4a2e1cb4ba2d42bfeb Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sun, 30 May 2010 21:15:20 +0200 Subject: [PATCH] revert to old behavior of getStartMilsecs; getStartMilsecs deprecated --- lib/pure/times.nim | 14 +++++++------- web/news.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/pure/times.nim b/lib/pure/times.nim index da712263de..144a6eb4fd 100755 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -139,7 +139,7 @@ proc `<=` * (a, b: TTime): bool = ## returns true iff ``a <= b``. result = a - b <= 0 -proc getStartMilsecs*(): int +proc getStartMilsecs*(): int {.deprecated.} ## get the miliseconds from the start of the program @@ -212,15 +212,15 @@ when not defined(ECMAScript): proc getStartMilsecs(): int = #echo "clocks per sec: ", clocksPerSec, "clock: ", int(clock()) #return clock() div (clocksPerSec div 1000) - when defined(posix): - var a: Ttimeval - posix_gettimeofday(a) - result = a.tv_sec * 1000 + a.tv_usec + when defined(macosx): + result = toInt(toFloat(clock()) / (toFloat(clocksPerSec) / 1000.0)) else: result = int(clock()) div (clocksPerSec div 1000) when false: - when defined(macosx): - result = toInt(toFloat(clock()) / (toFloat(clocksPerSec) / 1000.0)) + var a: Ttimeval + posix_gettimeofday(a) + result = a.tv_sec * 1000 + a.tv_usec + #echo "result: ", result proc getTime(): TTime = return timec(nil) proc getLocalTime(t: TTime): TTimeInfo = diff --git a/web/news.txt b/web/news.txt index 7de119d34b..6a65782ff4 100755 --- a/web/news.txt +++ b/web/news.txt @@ -13,7 +13,7 @@ Bugfixes - Bugfix: Passing a ``ref`` pointer to the untyped ``pointer`` type is invalid. - Bugfix: Updated ``keyval`` example. - Bugfix: ``system.splitChunk`` still contained code for debug output. -- Bugfix: ``times.getStartMilsecs`` uses ``gettimeofday`` for Posix times. It +- Bugfix: ``times.getStartMilsecs`` uses ``gettimeofday`` for Posix. It used to use ``clock`` which has the wrong semantics. - Bugfix: ``dialogs.ChooseFileToSave`` uses ``STOCK_SAVE`` instead of ``STOCK_OPEN`` for the GTK backend.