## xserver-timestamp.pkg
#
# An abstract interface to X-server time values.
#
# All our mouse and keyboard input events come
# timestamped with these.
#
# X time values are 32-bit values in milliseconds
# since the server was booted; they wrap around
# every 49.7 days.
# Compiled by:
#
src/lib/x-kit/xclient/xclient-internals.sublibstipulate
package f8b = eight_byte_float; # eight_byte_float is from
src/lib/std/eight-byte-float.pkgherein
package xserver_timestamp
: (weak) Xserver_Timestamp # Xserver_Timestamp is from
src/lib/x-kit/xclient/src/wire/xserver-timestamp.api {
Xserver_Timestamp
=
XSERVER_TIMESTAMP one_word_unt::Unt;
fun bin_op operator (XSERVER_TIMESTAMP t1, XSERVER_TIMESTAMP t2) = XSERVER_TIMESTAMP (operator (t1, t2));
fun cmp_op operator (XSERVER_TIMESTAMP t1, XSERVER_TIMESTAMP t2) = operator (t1, t2);
fun to_float (XSERVER_TIMESTAMP w)
=
convert w
where
fun convert w
=
if (w >= 0ux40000000)
#
convert (w - 0ux40000000) + 1073741824.0;
else
f8b::from_int (one_word_unt::to_int w);
fi;
end;
my (+) = bin_op one_word_unt::(+);
my (-) = bin_op one_word_unt::(-);
# If you use these, remember that X server times
# WRAP AROUND MONTHLY, so you cannot assume that
#
# time1 < time2
# => # DANGER!
# time1 earlier_than_time2:
#
my (<) = cmp_op one_word_unt::(<);
my (<=) = cmp_op one_word_unt::(<=);
my (>) = cmp_op one_word_unt::(>);
my (>=) = cmp_op one_word_unt::(>=);
};
end;
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.