From 22acc5a7d3baf416709601a8482856be36f2cb39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sun, 22 May 2016 09:52:48 -0400 Subject: [PATCH] contrib & lib: fix other clients of clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/friendz/src/friendz.nit | 12 ------------ lib/popcorn/README.md | 2 +- .../middlewares/example_advanced_logger.nit | 2 +- lib/popcorn/pop_middlewares.nit | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/contrib/friendz/src/friendz.nit b/contrib/friendz/src/friendz.nit index c0554fe..762eb1d 100644 --- a/contrib/friendz/src/friendz.nit +++ b/contrib/friendz/src/friendz.nit @@ -1609,22 +1609,10 @@ redef class App game.save end - # Maximum wanted frame per second - var max_fps = 30 - - # clock used to track FPS - private var clock = new Clock - redef fun frame_core(display) do game.step game.draw(display) - var dt = clock.lapse - var target_dt = 1000000000 / max_fps - if dt.sec == 0 and dt.nanosec < target_dt then - var sleep_t = target_dt - dt.nanosec - sys.nanosleep(0, sleep_t) - end end redef fun input(input_event) diff --git a/lib/popcorn/README.md b/lib/popcorn/README.md index 08f7c9a..4712faf 100644 --- a/lib/popcorn/README.md +++ b/lib/popcorn/README.md @@ -505,7 +505,7 @@ class LogHandler redef fun all(req, res) do var timer = req.timer if timer != null then - print "{req.method} {req.uri} {res.color_status} ({timer.total})" + print "{req.method} {req.uri} {res.color_status} ({timer.total}s)" else print "{req.method} {req.uri} {res.color_status}" end diff --git a/lib/popcorn/examples/middlewares/example_advanced_logger.nit b/lib/popcorn/examples/middlewares/example_advanced_logger.nit index b97d10c..7f8e3b1 100644 --- a/lib/popcorn/examples/middlewares/example_advanced_logger.nit +++ b/lib/popcorn/examples/middlewares/example_advanced_logger.nit @@ -34,7 +34,7 @@ class LogHandler redef fun all(req, res) do var timer = req.timer if timer != null then - print "{req.method} {req.uri} {res.color_status} ({timer.total})" + print "{req.method} {req.uri} {res.color_status} ({timer.total}s)" else print "{req.method} {req.uri} {res.color_status}" end diff --git a/lib/popcorn/pop_middlewares.nit b/lib/popcorn/pop_middlewares.nit index 38e4bd9..518d9dc 100644 --- a/lib/popcorn/pop_middlewares.nit +++ b/lib/popcorn/pop_middlewares.nit @@ -48,7 +48,7 @@ class ConsoleLog redef fun all(req, res) do var clock = req.clock if clock != null then - print "{req.method} {req.uri} {status(res)} ({clock.total})" + print "{req.method} {req.uri} {status(res)} ({clock.total}s)" else print "{req.method} {req.uri} {status(res)}" end -- 1.7.9.5