Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | removed the CONFIG variable from config.mk, renamed config.h into ↵ | arg@10ksloc.org | 2006-08-02 | 4 | -11/+66 | |
| | | | | config.default.h, after first clone/extract one needs to copy config.default.h to config.h, that is easier than always heavy typing make CONFIG=blafasel | |||||
* | added Acroread.* and MPlayer.* to config.arg.h rules | arg@10ksloc.org | 2006-08-02 | 1 | -0/+2 | |
| | ||||||
* | made fullscreen apps working fine in floating mode (there is no sane way to ↵ | arg@10ksloc.org | 2006-08-02 | 9 | -79/+92 | |
| | | | | make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander | |||||
* | new stuff | arg@10ksloc.org | 2006-08-02 | 2 | -20/+23 | |
| | ||||||
* | dwm is now exit, if stdin is closed due broken pipe | arg@10ksloc.org | 2006-08-02 | 1 | -8/+5 | |
| | ||||||
* | implemented focus on enterwindow on titlebars | arg@10ksloc.org | 2006-08-02 | 2 | -2/+2 | |
| | ||||||
* | applied Sanders patches (numlock2) | arg@10ksloc.org | 2006-08-02 | 5 | -26/+40 | |
| | ||||||
* | reverting to old resize policy | arg@10ksloc.org | 2006-08-02 | 2 | -21/+32 | |
| | ||||||
* | new resize stuff (using XConfigureWindow instead of XSendEvent) | arg@10ksloc.org | 2006-08-02 | 2 | -32/+21 | |
| | ||||||
* | renamed WM_PROTOCOL_DELWIN into PROTODELWIN | arg@10ksloc.org | 2006-08-01 | 3 | -3/+3 | |
| | ||||||
* | renamed ARRANGE into DEFMODE | arg@10ksloc.org | 2006-08-01 | 3 | -4/+3 | |
| | ||||||
* | small fixes to dwm.html | arg@10ksloc.org | 2006-08-01 | 1 | -6/+6 | |
| | ||||||
* | simplified README | arg@10ksloc.org | 2006-08-01 | 1 | -4/+1 | |
| | ||||||
* | removed 1 missing LOC | arg@10ksloc.org | 2006-08-01 | 1 | -1/+0 | |
| | ||||||
* | removed 5LOC | arg@10ksloc.org | 2006-08-01 | 2 | -15/+10 | |
| | ||||||
* | removed artefacts of single-linked list (thanx to Jukka, I must have been mad) | arg@10ksloc.org | 2006-08-01 | 2 | -9/+4 | |
| | ||||||
* | cleaned config.*h to prevent some confusion | arg@10ksloc.org | 2006-08-01 | 3 | -6/+5 | |
| | ||||||
* | saved 2LOC | arg@10ksloc.org | 2006-08-01 | 1 | -4/+2 | |
| | ||||||
* | uppercasing all define'd values (uppercase-prefixed should only be enum ↵ | arg@10ksloc.org | 2006-08-01 | 4 | -16/+16 | |
| | | | | field qualifiers) | |||||
* | fixed config.h files | arg@10ksloc.org | 2006-08-01 | 2 | -4/+2 | |
| | ||||||
* | centralized/externalized configuration to config.h | arg@10ksloc.org | 2006-08-01 | 9 | -107/+172 | |
| | ||||||
* | applied Cedric's NumLock patch | arg@10ksloc.org | 2006-08-01 | 1 | -1/+17 | |
| | ||||||
* | applied Jukkas prev/next patch with XK_{h,l} | arg@10ksloc.org | 2006-08-01 | 3 | -0/+18 | |
| | ||||||
* | applied Sanders patches | arg@10ksloc.org | 2006-08-01 | 8 | -58/+42 | |
| | ||||||
* | committed a patch which fixes the hints of Jukka | arg@10ksloc.org | 2006-08-01 | 4 | -40/+14 | |
| | ||||||
* | updated html | arg@10ksloc.org | 2006-07-21 | 1 | -1/+1 | |
| | ||||||
* | Added tag 0.5 for changeset 22213b9a2114167ee8ba019a012e27da0422a61a | arg@10ksloc.org | 2006-07-21 | 1 | -0/+1 | |
| | ||||||
* | prepared 0.5 0.5 | arg@10ksloc.org | 2006-07-21 | 1 | -3/+9 | |
| | ||||||
* | some cleanups/fixes inspired by Jukka Salmi's feedback | arg@10ksloc.org | 2006-07-21 | 4 | -13/+7 | |
| | ||||||
* | simplified main.c, switching back to single urxvt usage | arg@10ksloc.org | 2006-07-21 | 2 | -28/+14 | |
| | ||||||
* | s/sleep 5/sleep 2/ | arg@10ksloc.org | 2006-07-21 | 1 | -1/+1 | |
| | ||||||
* | changed the status info README hint (more simple now, no extra script necessary) | arg@10ksloc.org | 2006-07-21 | 1 | -7/+1 | |
| | ||||||
* | s/0.5/0.6/ - my steps are wider than the reality | arg@10ksloc.org | 2006-07-21 | 2 | -2/+2 | |
| | ||||||
* | applied sanders maxfix patch | arg@10ksloc.org | 2006-07-21 | 1 | -2/+2 | |
| | ||||||
* | added a note how to achieve status info in the bar | arg@10ksloc.org | 2006-07-21 | 1 | -1/+17 | |
| | ||||||
* | preparing 0.6 which will be available in the evening after sanders patch approx. | arg@10ksloc.org | 2006-07-21 | 2 | -21/+8 | |
| | ||||||
* | sanitization of several clunky stuff, removed heretag (rarely of use), ↵ | arg@10ksloc.org | 2006-07-21 | 4 | -48/+40 | |
| | | | | simplified pop(), changed shortcuts to always contain MODKEY | |||||
* | applied sanders no_sizehints for tiled mode patch (thx!) | arg@10ksloc.org | 2006-07-20 | 2 | -11/+11 | |
| | ||||||
* | serious mistake in pop() (forgot to set c->prev to NULL on pop) | arg@10ksloc.org | 2006-07-20 | 1 | -0/+1 | |
| | ||||||
* | using double-linked list in order to get correct prev focus handling | arg@10ksloc.org | 2006-07-20 | 4 | -21/+45 | |
| | ||||||
* | added yet another CUTOMIZE tag | arg@10ksloc.org | 2006-07-20 | 1 | -0/+2 | |
| | ||||||
* | cleaned the CUSTOMIZE flags | arg@10ksloc.org | 2006-07-20 | 3 | -5/+9 | |
| | ||||||
* | made status bar drawing more robust, implemented togglemax and togglemode, ↵ | arg@10ksloc.org | 2006-07-20 | 5 | -33/+59 | |
| | | | | works quite well | |||||
* | cleaned up code | arg@10ksloc.org | 2006-07-20 | 8 | -85/+78 | |
| | ||||||
* | Added tag 0.4 for changeset eb3165734f00fe7f7da8aeebaed00e60a57caac9 | arg@10ksloc.org | 2006-07-20 | 1 | -0/+1 | |
| | ||||||
* | prepared 0.4 0.4 | arg@10ksloc.org | 2006-07-20 | 2 | -4/+10 | |
| | ||||||
* | using O3 instead of Os, binary size still < 40kb | arg@10ksloc.org | 2006-07-20 | 1 | -1/+1 | |
| | ||||||
* | fixed version in man page | arg@10ksloc.org | 2006-07-20 | 1 | -1/+1 | |
| | ||||||
* | yet another html patch | arg@10ksloc.org | 2006-07-20 | 1 | -5/+5 | |
| | ||||||
* | updated html | arg@10ksloc.org | 2006-07-20 | 1 | #
#
# Nim's Runtime Library
# (c) Copyright 2019 Nim contributors
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
##[
The `std/monotimes` module implements monotonic timestamps. A monotonic
timestamp represents the time that has passed since some system defined
point in time. The monotonic timestamps are guaranteed not to decrease,
meaning that that the following is guaranteed to work:
]##
runnableExamples:
let a = getMonoTime()
let b = getMonoTime()
assert a <= b
##[
This is not guaranteed for the `times.Time` type! This means that the
`MonoTime` should be used when measuring durations of time with
high precision.
However, since `MonoTime` represents the time that has passed since some
unknown time origin, it cannot be converted to a human readable timestamp.
If this is required, the `times.Time` type should be used instead.
The `MonoTime` type stores the timestamp in nanosecond resolution, but note
that the actual supported time resolution differs for different systems.
See also
========
* `times module <times.html>`_
]##
import std/times
type
MonoTime* = object ## Represents a monotonic timestamp.
ticks: int64
when defined(macosx):
type
MachTimebaseInfoData {.pure, final, importc: "mach_timebase_info_data_t",
header: "<mach/mach_time.h>".} = object
numer, denom: int32
proc mach_absolute_time(): int64 {.importc, header: "<mach/mach.h>".}
proc mach_timebase_info(info: var MachTimebaseInfoData) {.importc,
header: "<mach/mach_time.h>".}
when defined(js):
proc getJsTicks: float =
## Returns ticks in the unit seconds.
when defined(nodejs):
{.emit: """
let process = require('process');
let time = process.hrtime();
`result` = time[0] + time[1] / 1000000000;
""".}
else:
proc jsNow(): float {.importjs: "window.performance.now()".}
result = jsNow() / 1000
# Workaround for #6752.
{.push overflowChecks: off.}
proc `-`(a, b: int64): int64 =
system.`-`(a, b)
proc `+`(a, b: int64): int64 =
system.`+`(a, b)
{.pop.}
elif defined(posix) and not defined(osx):
import std/posix
when defined(zephyr):
proc k_uptime_ticks(): int64 {.importc: "k_uptime_ticks", header: "<kernel.h>".}
proc k_ticks_to_ns_floor64(ticks: int64): int64 {.importc: "k_ticks_to_ns_floor64", header: "<kernel.h>".}
elif defined(windows):
proc QueryPerformanceCounter(res: var uint64) {.
importc: "QueryPerformanceCounter", stdcall, dynlib: "kernel32".}
proc QueryPerformanceFrequency(res: var uint64) {.
importc: "QueryPerformanceFrequency", stdcall, dynlib: "kernel32".}
proc getMonoTime*(): MonoTime {.tags: [TimeEffect].} =
## Returns the current `MonoTime` timestamp.
##
## When compiled with the JS backend and executed in a browser,
## this proc calls `window.performance.now()`.
## See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now)
## for more information.
when defined(js):
let ticks = getJsTicks()
result = MonoTime(ticks: (ticks * 1_000_000_000).int64)
elif defined(macosx):
let ticks = mach_absolute_time()
var machAbsoluteTimeFreq: MachTimebaseInfoData
mach_timebase_info(machAbsoluteTimeFreq)
result = MonoTime(ticks: ticks * machAbsoluteTimeFreq.numer div
machAbsoluteTimeFreq.denom)
elif defined(zephyr):
let ticks = k_ticks_to_ns_floor64(k_uptime_ticks())
result = MonoTime(ticks: ticks)
elif defined(posix):
var ts: Timespec
discard clock_gettime(CLOCK_MONOTONIC, ts)
result = MonoTime(ticks: ts.tv_sec.int64 * 1_000_000_000 +
ts.tv_nsec.int64)
elif defined(windows):
var ticks: uint64
QueryPerformanceCounter(ticks)
var freq: uint64
QueryPerformanceFrequency(freq)
let queryPerformanceCounterFreq = 1_000_000_000'u64 div freq
result = MonoTime(ticks: (ticks * queryPerformanceCounterFreq).int64)
proc ticks*(t: MonoTime): int64 =
## Returns the raw ticks value from a `MonoTime`. This value always uses
## nanosecond time resolution.
t.ticks
proc `$`*(t: MonoTime): string =
$t.ticks
proc `-`*(a, b: MonoTime): Duration =
## Returns the difference between two `MonoTime` timestamps as a `Duration`.
initDuration(nanoseconds = (a.ticks - b.ticks))
proc `+`*(a: MonoTime, b: Duration): MonoTime =
## Increases `a` by `b`.
MonoTime(ticks: a.ticks + b.inNanoseconds)
proc `-`*(a: MonoTime, b: Duration): MonoTime =
## Reduces `a` by `b`.
MonoTime(ticks: a.ticks - b.inNanoseconds)
proc `<`*(a, b: MonoTime): bool =
## Returns true if `a` happened before `b`.
a.ticks < b.ticks
proc `<=`*(a, b: MonoTime): bool =
## Returns true if `a` happened before `b` or if they happened simultaneous.
a.ticks <= b.ticks
proc `==`*(a, b: MonoTime): bool =
## Returns true if `a` and `b` happened simultaneous.
a.ticks == b.ticks
proc high*(typ: typedesc[MonoTime]): MonoTime =
## Returns the highest representable `MonoTime`.
MonoTime(ticks: high(int64))
proc low*(typ: typedesc[MonoTime]): MonoTime =
## Returns the lowest representable `MonoTime`.
MonoTime(ticks: low(int64))
|