]> git.saurik.com Git - apple/libdispatch.git/blobdiff - man/dispatch_time.3
libdispatch-913.20.5.tar.gz
[apple/libdispatch.git] / man / dispatch_time.3
index 4b4f9d8635a07c0ec50bd7e2a4ad038d0a9e11d4..685898de06a4b7d4a8a6ccff86e786407b8f66ea 100644 (file)
@@ -80,28 +80,10 @@ parameter is ignored.
 .Pp
 Underflow causes the smallest representable value to be
 returned for a given clock.
-.Sh CAVEATS
-Under the C language, untyped numbers default to the
-.Vt int
-type. This can lead to truncation bugs when arithmetic operations with other
-numbers are expected to generate a
-.Vt int64_t
-sized result, such as the
-.Fa offset
-argument to
-.Fn dispatch_time
-and
-.Fn dispatch_walltime .
-When in doubt, use
-.Vt ull
-as a suffix. For example:
-.Bd -literal -offset indent
-3ull * NSEC_PER_SEC
-.Ed
 .Sh EXAMPLES
 Create a milestone two seconds in the future:
 .Bd -literal -offset indent
-milestone = dispatch_time(DISPATCH_TIME_NOW, 2LL * NSEC_PER_SEC);
+milestone = dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC);
 .Ed
 .Pp
 Create a milestone for use as an infinite timeout:
@@ -116,6 +98,11 @@ ts.tv_sec = 0x7FFFFFFF;
 ts.tv_nsec = 0;
 milestone = dispatch_walltime(&ts, 0);
 .Ed
+.Pp
+Use a negative delta to create a milestone an hour before the one above:
+.Bd -literal -offset indent
+milestone = dispatch_walltime(&ts, -60 * 60 * NSEC_PER_SEC);
+.Ed
 .Sh RETURN VALUE
 These functions return an abstract value for use with
 .Fn dispatch_after ,