.Dd August 12, 2002 .Dt ADJTIME 1 .Os NetBSD 1.4T .Sh NAME .Nm adjtime .Nd time adjustment utility .Sh SYNOPSIS .Nm adjtime .Op Fl q .Op Fl a|s|as|sa|n .Op Ar arg .Sh DESCRIPTION .Nm adjtime is a time adjustment utility, essentially an interface to the .Xr adjtime 2 syscall. .Pp If no arguments are given, .Nm adjtime simply prints the current clock adjustment value. This cannot be done without disturbing it slightly, but .Nm adjtime tries to disturb it as little as possible. .Pp If one or more arguments are given, the .Ar arg is not optional; its interpretation depends on which flag, if any, is specified. (If multiple flags are specified, the last one overrides all previous, except that .Fl q is independent from all the rest.) .Nm adjtime determines a time from .Ar arg as described below. If no flag is given, .Nm adjtime then either adjusts the clock, if the adjustment would be less than five minutes, or sets it, if the adjustment would be five minutes or more. .Pp .Bl -tag -width indent .It Fl a Specifies that the clock is always to be adjusted, regardless of how large the adjustment would be. Since most kernels misbehave when handed a sufficiently large adjustment (where .Dq "sufficiently large" is on the order of an hour), .Nm adjtime limits the adjustment to less than 2001 seconds. If the adjustment is that large, run .Nm adjtime again later to request more adjustment. .It Fl s Always set the time, regardless of how small the difference is. .It Fl as , Fl sa Adjust the clock, unless the adjustment would be an advance of less than a second, in which case simply set it. .It Fl n Restore the default of choosing .Fl a mode or .Fl s mode depending on whether the adjustment is less than five minutes or not. .It Fl q Don't actually do anything; instead, simply print what would be done. With this option, .Nm does not have to be run by root (which it otherwise does, because .Xr adjtime 2 and .Xr settimeofday 2 , the syscalls used, do not function otherwise). .El .Pp The .Ar arg is used to deterime the time. .Pp If it consists entirely of digits, optionally with a dot before the last two digits, and has at least one digit (before the dot, if the dot is present), then it is taken as a numeric time in the style yyyymmddhhmm (if the dot and final two digits are given, they specify seconds). Omitted fields at the left take their values from the current time, with one exception: if the year is only two digits long, instead of simply taking the century number from the current time, the century is chosen so that the year is within fifty years of the current time's year. .Pp Otherwise, it must be a network hostname, or a numeric address (anything acceptable to .Xr getaddrinfo 3 ) . .Nm connects to the .Sq time/tcp service to obtain the time. .Sh BUGS There are probably bugs related to using a numerically-specified time that falls during a summer-time adjustment period (that falls in the hour that doesn't exist or the hour that exists twice); the resulting time may not be quite what you want, though the program shouldn't crash. .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .