The value of
( increases as time passes
(increasing by 1 for each second that passes). The current time in
seconds can be compared with a time returned by
(see section 11.3.3).
secs-n, a platform-specific
time in seconds (an exact integer) returned by
file-or-directory-modify-seconds, and returns an instance
date structure type, as described below. If
secs-n is too small or large, the
exn:fail exception is raised.
time-zone-offset: the number of seconds east of GMT for this time zone (e.g., Pacific Standard Time is
-28800), an exact integer 50
date structure type is transparent to all inspectors (see
) returns the current ``time'' in fixnum
milliseconds (possibly negative). This time is based on a
platform-specific starting date or on the machine's startup
time. Since the result is a fixnum, the value increases only over a
limited (though reasonably long) time.
) returns the current ``time'' in
positive milliseconds, not necessarily an integer. This time is based
on a platform-specific starting date or on the machine's startup
time, but it never decreases (until the machine is turned off).
) returns the amount of processor
time in fixnum milliseconds that has been consumed by the MzScheme
process on the underlying operating system. (Under Unix and Mac OS X, this
includes both user and system time.) The precision of the result is
platform-specific, and since the result is a fixnum, the value
increases only over a limited (though reasonably long) time.
) returns the amount of processor time in
fixnum milliseconds that has been consumed by MzScheme's garbage
collection so far. This time is a portion of the time reported by
procedure collects timing information for a
)invokes the procedure
procwith the arguments in
arg-list. Four values are returned: a list containing the result(s) of applying
proc, the number of milliseconds of CPU time required to obtain this result, the number of ``real'' milliseconds required for the result, and the number of milliseconds of CPU time (included in the first result) spent on garbage collection.
The reliability of the timing numbers depends on the platform; see section 15.1.2 for more information on time accounting. If multiple MzScheme threads are running, then the reported time may include work performed by other threads.
(timetimes the evaluation of
expr, printing timing information to the current output port. The result of the
expression is the result of
stderr-output-port command-path arg-string ···
) creates a new process in
the underlying operating system to execute
command-path argument is a path to a
program executable, and the
arg-strings are command-line
arguments for the program. Under Unix and Mac OS X, command-line
arguments are passed as byte strings using the current locale's
encoding (see section 1.2.3).
Under Windows, the first
arg-string can be
which triggers a Windows-specific hack: the second
is used exactly as the command-line for the subprocess, and no
arg-strings can be supplied. Otherwise, a
command-line string is constructed from
arg-string so that a typical Windows console application can
parse it back to an array of arguments.51 If
provided on a non-Windows platform, the
exn:fail:contract exception is raised.
Unless it is
stdout-output-port is used for the
launched process's standard output,
stdin-input-port is used
for the process's standard input, and
used for the process's standard error. All provided ports must be
file-stream ports. Any of the ports can be
#f, in which case
a system pipe is created and returned by
each port that is provided, no pipe is created and the corresponding
returned value is
procedure returns four values:
a subprocess value representing the created process;
an input port piped from the process's standard output, or
stdout-output-portwas a port;
an output port piped to the process standard input, or
stdin-input-portwas a port;
an input port piped from the process's standard error, or
stderr-output-portwas a port.
Important: All ports returned from
explicitly closed with
The returned ports are file-stream ports (see section 11.1.6),
and they are placed into the management of the current custodian (see
section 9.2). The
exn:fail exception is raised when a low-level error
prevents the spawning of a process or the creation of operating
system pipes for process communication.
A subprocess value can be used to obtain further information about the process:
'runningif the process is still running, or its exit code otherwise. The exit code is an exact integer, and
0typically indicates success. If the process terminated due to a fault or signal, the exit code is non-zero.
)terminates the subprocess if
force?is true and if the process still running, then returns void. If an error occurs during termination, the
exn:failexception is raised.
#funder Unix and Mac OS X, the subprocess is sent an interrupt signal instead of a kill signal (and the subprocess might handle the signal without terminating). Under Windows, no action is taken when
shell-execute#f "http://www.plt-scheme.org" "" (
verb-string can be
#f, in which case the operating
system will use a default verb. Common verbs include
target-string is the target for the action, usually a
filename path. The file could be executable, or it could be a file
with a recognized extension that can be handled by an installed
parameters-string argument is passed on to the system to
perform the action. For example, in the case of opening an
parameters-string is used as the command line
(after the executable name).
dir-path is used as the current directory when performing
show-mode-symbol sets the display mode for a Window
affected by the action. It must be one of the following symbols; the
description of each symbol's meaning is taken from the Windows API
If the action fails, the
exn:fail exception is raised. If the action succeeds,
the result is
#f. In future versions of MzScheme, the
result may be a subprocess value (see section 15.2) if the
operating system did returns a process handle (but if a subprocess
value is returned, its process ID will be
0 instead of the
real process ID).
) gets the value of an operating system
environment variable. The
name-string argument cannot contain a
null character; if an environment variable named by
exists, its value is returned (as a string); otherwise,
) sets the value of an operating
system environment variable. The
value-string arguments are strings that cannot contain a null
character; the environment variable named by
name-string is set
value-string. The return value is
#t if the
Future ports of MzScheme will expand this list of system types. If
details? is not
#f, then the result is a string, which
contains further details about the operating system and the current
machine in a platform-specific format.
) returns a string to identify the
current user's language and country. Under Unix and Mac OS X, the
string is five characters: two lowercase ASCII letters for the
language, an underscore, and two uppercase ASCII letters for the
country. Under Windows, the string can be arbitrarily long, but the
language and country are in English (all ASCII letters or spaces)
separated by an underscore. Under Unix, the result is determined by
checking the LC_ALL, LC_TYPE, and LANG
environment variables, in that order (and the result is used if the
environment variable's value starts with two lowercase ASCII letters,
an underscore, and two uppercase ASCII letters, followed by either
nothing or a period). Under Windows and Mac OS X, the result is
determined by system calls.
) returns a relative directory
path string. This string can be used to build paths to
system-specific files. For example, when MzScheme is running under
Solaris on a Sparc architecture, the subpath is
"sparc-solaris", while the subpath for Windows on an Intel
"win32\\i386". The subpath also
distinguishes among MzScheme variants (e.g., the ``3m'' variant with
more precise garbage collection) by extending the ``normal'' variant
path with a subdirectory. If
the returned path is for the ``normal'' variant.
mutable-vector to report current performance
thread is specified, a particular set of
thread-specific statistics are reported, otherwise a different set of
global statics are reported.
For global statistics, up to 8 elements are set in the vector,
starting from the beginning. (In future versions of MzScheme,
additional elements will be set.) If
mutable-vector has n
elements where n < 8, then the n elements are set to the first
n performance-statistics values. The reported statistics values are
as follows, in the order that they are set within
0: The same value as returned by
current-process-milliseconds(see section 15.1.2).
1: The same value as returned by
current-milliseconds(see section 15.1.2).
2: The same value as returned by
current-gc-milliseconds(see section 15.1.2).
3: The number of garbage collections performed since start-up.
4: The number of thread context switches performed since start-up.
5: The number of internal stack overflows handled since start-up.
6: The number of threads currently scheduled for execution (i.e., threads that are running, not suspended, and not unscheduled due to a synchronization).
7: The number of syntax objects read from compiled code since start-up.
For thread-specific statistics, up to 4 elements are set in the vector:
#tif the thread is running,
#fotherwise (same result as
#tif the thread has terminated,
#fotherwise (same result as
#tif the thread is currently blocked on a synchronizable event (or sleeping for some number of milliseconds),
3: The number of bytes currently in use for the thread's continuation.
50 The value produced for the
tends to be sensitive to the value of the
environment variable, especially on Unix
platforms. Consult the system documentation (usually
under tzset) for details.