~ehmry/nim_tox

97b3dfc4f9ff92238cf475d174a6fdb5d801152d — Emery Hemingway 2 months ago 4a4a4a5 master
Return a Duration from iteration_interval
1 files changed, 4 insertions(+), 4 deletions(-)

M src/toxcore.nim
M src/toxcore.nim => src/toxcore.nim +4 -4
@@ 1,7 1,7 @@
# SPDX-FileCopyrightText: 2019 Emery Hemingway
# SPDX-License-Identifier: GPL-3.0-or-later

import std/strutils
import std/[strutils, times]

{.passC: staticExec("pkg-config --cflags toxcore").}
{.passL: staticExec("pkg-config --libs toxcore").}


@@ 457,18 457,18 @@ callbackSetter self_connection_status:
  proc wrapper(core: Core; status: Connection; user_data: pointer) {.cdecl.} =
    callThru(status)

proc iteration_interval*(tox: Tox): int =
proc iteration_interval*(tox: Tox): Duration =
  ## Return the time in milliseconds before `iterate(tox)` should be called again
  ## for optimal performance.
  proc iteration_interval(core: Core): uint32 {.ctoxProc.}
  (int)tox.core.iteration_interval()
  initDuration(milliseconds = tox.core.iteration_interval().int64)

proc iterate*(tox: var Tox) {.tags: [IOEffect].} =
  ##  Iterate the Tox main loop.
  ##
  ## .. code-block:: nim
  ##   while true:
  ##     poll(tox.iterationInterval)
  ##     poll(tox.iterationInterval.inMilliseconds)
  ##     tox.itererate()
  proc iterate(core: Core; user_data: pointer) {.ctoxProc.}
  tox.core.iterate(addr tox)