HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
and
computer programming Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
, system time represents a computer system's notion of the passage of time. In this sense, ''time'' also includes the passing of days on the calendar. System time is measured by a ''system clock'', which is typically implemented as a simple count of the number of ''ticks'' that have transpired since some arbitrary starting date, called the ''
epoch In chronology and periodization, an epoch or reference epoch is an instant in time chosen as the origin of a particular calendar era. The "epoch" serves as a reference point from which time is measured. The moment of epoch is usually decided b ...
''. For example,
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and
POSIX The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
-compliant systems encode system time ("
Unix time Unix time is a date and time representation widely used in computing. It measures time by the number of non-leap seconds that have elapsed since 00:00:00 Coordinated Universal Time, UTC on 1 January 1970, the Unix Epoch (computing), epoc ...
") as the number of seconds elapsed since the start of the Unix epoch at 1 January 1970 00:00:00 UT, with exceptions for
leap second A leap second is a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC), to accommodate the difference between precise time (International Atomic Time (TAI), as measured by atomic clocks) and imprecise solar tim ...
s. Systems that implement the 32-bit and 64-bit versions of the
Windows API The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
, such as
Windows 9x Windows 9x is a generic term referring to a line of discontinued Microsoft Windows operating systems released from 1995 to 2000 and supported until 2006, which were based on the kernel introduced in Windows 95 and modified in succeeding version ...
and
Windows NT Windows NT is a Proprietary software, proprietary Graphical user interface, graphical operating system produced by Microsoft as part of its Windows product line, the first version of which, Windows NT 3.1, was released on July 27, 1993. Original ...
, provide the system time as both , represented as a year/month/day/hour/minute/second/milliseconds value, and , represented as a count of the number of 100-nanosecond ticks since 1 January 1601 00:00:00 UT as reckoned in the proleptic Gregorian calendar. System time can be converted into calendar time, which is a form more suitable for human comprehension. For example, the Unix system time ' seconds since the beginning of the epoch translates into the calendar time ''9 September 2001 01:46:40 UT''. Library
subroutine In computer programming, a function (also procedure, method, subroutine, routine, or subprogram) is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times. Callable units provide a ...
s that handle such conversions may also deal with adjustments for
time zone A time zone is an area which observes a uniform standard time for legal, Commerce, commercial and social purposes. Time zones tend to follow the boundaries between Country, countries and their Administrative division, subdivisions instead of ...
s,
daylight saving time Daylight saving time (DST), also referred to as daylight savings time, daylight time (Daylight saving time in the United States, United States and Daylight saving time in Canada, Canada), or summer time (British Summer Time, United Kingdom, ...
(DST), leap seconds, and the user's locale settings. Library routines are also generally provided that convert calendar times into system times. Many implementations that currently store system times as 32-bit integer values will suffer from the impending Year 2038 problem. These time values will overflow ("run out of bits") after the end of their system time epoch, leading to software and hardware errors. These systems will require some form of remediation, similar to efforts required to solve the earlier
Year 2000 problem The term year 2000 problem, or simply Y2K, refers to potential computer errors related to the Time formatting and storage bugs, formatting and storage of calendar data for dates in and after the year 2000. Many Computer program, programs repr ...
. This will also be a potentially much larger problem for existing data file formats that contain system timestamps stored as 32-bit values.


Other time measurements

Closely related to system time is '' process time'', which is a count of the total CPU time consumed by an executing
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management * Business process, activities that produce a specific s ...
. It may be split into ''user'' and ''system'' CPU time, representing the time spent executing user code and system kernel code, respectively. Process times are a tally of CPU instructions or clock cycles and generally have no direct correlation to wall time. File systems keep track of the times that files are created, modified, and/or accessed by storing
timestamp A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second. Timestamps do not have to be based on some absolu ...
s in the file control block (or
inode An inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attribu ...
) of each file and directory.


History

Most first-generation
personal computer A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
s did not keep track of dates and times. These included systems that ran the
CP/M CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/Intel 8085, 85-based microcomputers by Gary Kildall of Digital Research, Dig ...
operating system, as well as early models of the
Apple II Apple II ("apple Roman numerals, two", stylized as Apple ][) is a series of microcomputers manufactured by Apple Computer, Inc. from 1977 to 1993. The Apple II (original), original Apple II model, which gave the series its name, was designed ...
, the BBC Micro, and the Commodore PET, among others. Add-on peripheral, peripheral boards that included real-time clock chips with on-board Electric battery, battery back-up were available for the [
IBM PC The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the List of IBM Personal Computer models, IBM PC model line and the basis for the IBM PC compatible ''de facto'' standard. Released on ...
and XT, but the IBM AT was the first widely available PC that came equipped with date/time hardware built into the
motherboard A motherboard, also called a mainboard, a system board, a logic board, and informally a mobo (see #Nomenclature, "Nomenclature" section), is the main printed circuit board (PCB) in general-purpose computers and other expandable systems. It ho ...
. Prior to the widespread availability of
computer network A computer network is a collection of communicating computers and other devices, such as printers and smart phones. In order to communicate, the computers and devices must be connected by wired media like copper cables, optical fibers, or b ...
s, most personal computer systems that did track system time did so only with respect to local time and did not make allowances for different
time zone A time zone is an area which observes a uniform standard time for legal, Commerce, commercial and social purposes. Time zones tend to follow the boundaries between Country, countries and their Administrative division, subdivisions instead of ...
s. With current technology, most modern computers keep track of local civil time, as do many other household and personal devices such as VCRs, DVRs, cable TV receivers, PDAs,
pager A pager, also known as a beeper or bleeper, is a Wireless communication, wireless telecommunications device that receives and displays Alphanumericals, alphanumeric or voice messages. One-way pagers can only receive messages, while response p ...
s,
cell phone A mobile phone or cell phone is a portable telephone that allows users to make and receive calls over a radio frequency link while moving within a designated telephone service area, unlike fixed-location phones ( landline phones). This radio ...
s,
fax machine Fax (short for facsimile), sometimes called telecopying or telefax (short for telefacsimile), is the telephonic transmission of scanned printed material (both text and images), normally to a telephone number connected to a printer or other out ...
s, telephone answering machines,
camera A camera is an instrument used to capture and store images and videos, either digitally via an electronic image sensor, or chemically via a light-sensitive material such as photographic film. As a pivotal technology in the fields of photograp ...
s,
camcorder A camcorder is a self-contained portable electronic device with video and recording as its primary function. It is typically equipped with an articulating screen mounted on the left side, a belt to facilitate holding on the right side, hot-sw ...
s, central air conditioners, and
microwave oven A microwave oven, or simply microwave, is an electric oven that heats and cooks food by exposing it to electromagnetic radiation in the microwave frequency range. This induces Dipole#Molecular dipoles, polar molecules in the food to rotate and ...
s.
Microcontroller A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable input/output peripherals. Pro ...
s operating within
embedded system An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
s (such as the
Raspberry Pi Raspberry Pi ( ) is a series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in collaboration with Broadcom Inc., Broadcom. To commercialize the product and support its growing demand, the ...
,
Arduino Arduino () is an Italian open-source hardware and open-source software, software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardwar ...
, and other similar systems) do not always have internal hardware to keep track of time. Many such controller systems operate without knowledge of the external time. Those that require such information typically initialize their base time upon rebooting by obtaining the current time from an external source, such as from a time server or external clock, or by prompting the user to manually enter the current time.


Implementation

The system clock is typically implemented as a programmable interval timer that periodically interrupts the CPU, which then starts executing a timer interrupt service routine. This routine typically adds one tick to the system clock (a simple counter) and handles other periodic housekeeping tasks ( preemption, etc.) before returning to the task the CPU was executing before the interruption.


Retrieving system time

The following tables illustrate methods for retrieving the system time in various
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
s,
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s, and applications. Values marked by (*) are system-dependent and may differ across implementations. All dates are given as Gregorian or proleptic Gregorian calendar dates. The resolution of an implementation's measurement of time does not imply the same precision of such measurements. For example, a system might return the current time as a value measured in microseconds, but actually be capable of discerning individual clock ticks with a frequency of only 100 Hz (10 ms).


Operating systems


Programming languages and applications


See also


Notes


References


External links

*
Critical and Significant Dates
', J. R. Stockton ''(retrieved 3 December 2015)'' *

' (C++) *

' (C++) *
The Chronos Date/Time Library
' (Smalltalk) *
Joda Time
', The Joda Date/Time Library (Java) *
The Perl DateTime Project
'' (Perl) *

' (Ruby) {{DEFAULTSORT:System Time Operating system technology Computer programming Computer real-time clocks