History log of /fuchsia/zircon/system/public/zircon/time.h
Revision Date Author Comments
# e302c45d 26-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[zircon][syscalls] Make zx_time_t and zx_duration_t signed types

This change is part of a hard transition and breaks the layers above.

zx_time_t and zx_duration_t are now int64_t. ZX_TIME_INFINITE is now
INT64_MAX.

A negative time value passed to a syscall is treated as any other time
value that's "in the past".

Test: CQ; new unit tests; built and ran topaz system on Eve

ZX-2100 #comment

Change-Id: I2a020cb2cf3dd7212608e24c1ee90cec58dd51ef


# b33437b1 26-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[zircon][kernel] Use proper time types and overflow-safe arithmetic

This change is preparation for converting zx_time_t and zx_duration_t
from unsigned to signed types (ZX-2100).

1. Fix several places where the wrong time type was used (e.g.
zx_time_t instead of zx_duration_t). Because these are simple typedefs
it's easy to use the wrong one. While it generally doesn't cause a
problem, using the wrong type can be misleading and lead to bugs like
passing a relative time when an absolute time is expected.

2. Update kernel/ and some other parts of zircon to use the new
overflow-safe arithmetic functions from zircon/time.h.

Performance: Ran "/pkgfs/packages/zircon_benchmarks/0/bin/app -p" on
NUC before and after this change. Differences were withing the noise,
some slightly faster, some slightly slower.

Test: CQ

ZX-2100 #comment cleanup before conversion

Change-Id: I75d074e5850ade5385decd9bbf330497bf7610e9


# 1a655b47 02-Aug-2018 Benjamin Lerman <qsr@chromium.org>

[ulib] Make duration overflow safe operation constexpr

This allows to make operation on zx::duration constexpr too.

TEST=Everything still compiles.

Change-Id: I4ce4b9a87ec91670cdc597ed1705c2bb0ebb08dd


# 7709c88e 25-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[ulib] Use overflow-safe arithmetic in zx::time

This is a reland of 4c10d080ba1d3bf9f9a810b9a01a582221fe1553

Expand zircon/time.h and use the overflow-safe routines in zx::time
and zx::duration.

Tested: /boot/test/sys/time-test

ZX-2100 #comment more overflow-safe routines

Original Change-Id: Ibc07d5d1993f87fa461f41c7bb0a4a0aba5d2728

Change-Id: Id16828d8313148b6d280ea3d2453d0f6c4111fb9


# 89a5a27d 31-Jul-2018 Nick Maniscalco <maniscalco@google.com>

Revert "[ulib] Use overflow-safe arithmetic in zx::time"

This reverts commit 4c10d080ba1d3bf9f9a810b9a01a582221fe1553.

Reason for revert: Breaks garnet roller because some constexpr's depend on zx::time operations being constexpr.

Original change's description:
> [ulib] Use overflow-safe arithmetic in zx::time
>
> Expand zircon/time.h and use the overflow-safe routines in zx::time
> and zx::duration.
>
> Tested: /boot/test/sys/time-test
>
> ZX-2100 #comment more overflow-safe routines
>
> Change-Id: Ibc07d5d1993f87fa461f41c7bb0a4a0aba5d2728

TBR=travisg@google.com,jeffbrown@google.com,maniscalco@google.com,joshuaseaton@google.com

Change-Id: I7bdc59143900bfa2a4a98eace560c624e4aba45b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true


# 4c10d080 25-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[ulib] Use overflow-safe arithmetic in zx::time

Expand zircon/time.h and use the overflow-safe routines in zx::time
and zx::duration.

Tested: /boot/test/sys/time-test

ZX-2100 #comment more overflow-safe routines

Change-Id: Ibc07d5d1993f87fa461f41c7bb0a4a0aba5d2728


# 1c65857e 17-Jul-2018 Nick Maniscalco <maniscalco@google.com>

[kernel][ulib] Use overflow-safe arithmetic for kernel timers

Add overflow-safe routines for performing arithmetic on zx_time_t and
and zx_duration_t objects. In the future, we'll expand the set to
include more operations (multiplication, conversion, etc.).

Use the new routines for kernel timers.

Currently, zx_time_t and zx_duration_t are unsigned types, but in the
future they will be changed to signed types. The idea is to use the
new routines when performing arithmetic on these types in order to
prevent bugs resulting from overflow/underflow.

Tested: added new unit test (time-test) and ran "k timer_tests"

ZX-2100 #comment prereq

Change-Id: I271b858f266346e1d4fd7ab1930dcc535e3bee03