System time

{{Short description|Representation of time used in computers}}

{{Redirect-distinguish|System clock|Clock generator|Clock signal|Clock rate}}

File:Unix time.png command]]

In computer science and computer programming, 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. For example, Unix and POSIX-compliant systems encode system time ("Unix time") 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 seconds. Systems that implement the 32-bit and 64-bit versions of the Windows API, such as Windows 9x and Windows NT, provide the system time as both {{mono|SYSTEMTIME}}, represented as a year/month/day/hour/minute/second/milliseconds value, and {{mono|FILETIME}}, 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 {{gaps|1|000|000|000}} seconds since the beginning of the epoch translates into the calendar time 9 September 2001 01:46:40 UT. Library subroutines that handle such conversions may also deal with adjustments for time zones, daylight saving time (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. 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. 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 timestamps in the file control block (or inode) of each file and directory.

History

Most first-generation personal computers did not keep track of dates and times. These included systems that ran the CP/M operating system, as well as early models of the Apple II, the BBC Micro, and the Commodore PET, among others. Add-on peripheral boards that included real-time clock chips with on-board battery back-up were available for the IBM PC and XT, but the IBM AT was the first widely available PC that came equipped with date/time hardware built into the motherboard. Prior to the widespread availability of computer networks, 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 zones.

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, pagers, cell phones, fax machines, telephone answering machines, cameras, camcorders, central air conditioners, and microwave ovens.

Microcontrollers operating within embedded systems (such as the Raspberry Pi, Arduino, 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

class="wikitable noprint" style="text-align:center; margin:0.5em auto"
{{#time:d F Y H:i:s}} UTC

{{small|The Wikipedia system time when this page was last generated.
→ {{Purge|Purge this page, and update this counter.}}}}

The following tables illustrate methods for retrieving the system time in various operating systems, programming languages, 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=

class="wikitable" style="width:98%; background:#F0F0E7"
style="background:#E0E0E0; width:25%" | Operating system

! style="background:#E0E0E0; width:30%" | Command or function

! style="background:#E0E0E0; width:15%" | Resolution

! style="background:#E0E0E0; width:30%" | Epoch or range

rowspan="1" |Android

| {{code|java.lang}}{{code|.System.currentTimeMillis()}}

| rowspan="1" |1 ms

| rowspan="1" |1 January 1970

rowspan="3" |BIOS (IBM PC)

| {{code|1=INT 1Ah, AH=00h}}{{cite web|author=Ralf D. Brown|author-link=Ralf D. Brown|title=Int 0x1A, AH=0x00|work=Ralf Brown's Interrupt List|date=2000|url=http://www.delorie.com/djgpp/doc/rbinter/ix/1A/00.html}}

| 54.9254 ms
18.2065 Hz

| Midnight of the current day

{{code|1=INT 1Ah, AH=02h}}{{cite web|author=Ralf D. Brown|author-link=Ralf D. Brown|title=Int 0x1A, AH=0x02|work=Ralf Brown's Interrupt List|date=2000|url=http://www.delorie.com/djgpp/doc/rbinter/ix/1A/02.html}}

| 1 s

| Midnight of the current day

{{code|1=INT 1Ah, AH=04h}}{{cite web|author=Ralf D. Brown|author-link=Ralf D. Brown|title=Int 0x1A, AH=0x04|work=Ralf Brown's Interrupt List|date=2000|url=http://www.delorie.com/djgpp/doc/rbinter/ix/1A/04.html}}

| 1 day

| 1 January 1980 to 31 December 1999 or 31 December 2079 (system dependent)

rowspan="2" | CP/M Plus

| System Control Block:{{cite web |url=http://www.cpm.z80.de/manuals/cpm3-sys.pdf |title=CP/M Plus (CP/M Version 3.0) Operating System Guide}}
{{code|scb$base+58h}}, Days since 31 December 1977
{{code|scb$base+5Ah}}, Hour (BCD)
{{code|scb$base+5Bh}}, Minute (BCD)
{{code|scb$base+5Ch}}, Second (BCD)

| rowspan="2" | 1 s

| rowspan="2" | 31 December 1977 to 5 June 2157

BDOS function {{code|69h}}> ({{code|T_GET}}):{{cite web |url=http://www.seasip.info/Cpm/bdos.html#105 |title=BDOS system calls}}
{{code|word}}, Days since 1 January 1978
{{code|byte}}, Hour (BCD)
{{code|byte}}, Minute (BCD)
{{code|byte}}, Second (BCD)
rowspan="2" | DOS (Microsoft)

| {{code|C:\>}} DATE (command)
{{code|C:\>}} TIME (command)

| rowspan="2" | 10 ms

| rowspan="2" | 1 January 1980 to 31 December 2099

{{code|1=INT 21h, AH=2Ch SYSTEM TIME}}{{cite web|author=Ralf D. Brown|author-link=Ralf D. Brown|title=Int 0x21, AH=0x2c|work=Ralf Brown's Interrupt List|date=2000|url=http://www.delorie.com/djgpp/doc/rbinter/ix/21/2C.html}}
{{code|1=INT 21h, AH=2Ah SYSTEM DATE}}{{cite web|author=Ralf D. Brown|author-link=Ralf D. Brown|title=Int 0x21, AH=0x2a|work=Ralf Brown's Interrupt List|date=2000|url=http://www.delorie.com/djgpp/doc/rbinter/ix/21/2A.html}}
iOS (Apple)

| {{code|CFAbsoluteTimeGetCurrent()}}{{cite web|url=https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFTimeUtils/Reference/reference.html#//apple_ref/doc/c_ref/CFAbsoluteTimeGetCurrent|title=Time Utilities Reference|work=iOS Developer Library|date=2007}}

| < 1 ms

| 1 January 2001 ±10,000 years

macOS

| {{code|CFAbsoluteTimeGetCurrent()}}{{cite web|url=https://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFTimeUtils/Reference/reference.html|title=Time Utilities Reference|work=Mac OS X Developer Library|date=2007}}

| < 1 ms{{cite web |title=Time Utilities - Foundation |url=https://developer.apple.com/documentation/corefoundation/time_utilities |access-date=6 July 2022 |work=Apple Developer Documentation}}The Apple Developer Documentation is not clear on the precision & range of CFAbsoluteTime/CFTimeInterval, except in the CFRunLoopTimerCreate documentation which refers to 'sub-millisecond at most' precision. However, the similar type [https://developer.apple.com/documentation/foundation/nstimeinterval NSTimeInterval] appears to be interchangeable, and has the precision and range listed.

| 1 January 2001 ±10,000 years

rowspan="3" |OpenVMS

| {{code|SYS$GETTIM()}}

| 100 ns{{cite book|title=VAX/VMS Internals and Data Structures, Version 5.2|url=https://books.google.com/books?id=D7xQAAAAMAAJ|isbn=978-1555580599|author1=Ruth E. Goldenberg|author2=Lawrence J. Kenah|author3=Denise E. Dumas|publisher=Digital Press|date=1991}}

| 17 November 1858 to 31 July 31,086{{Cite web | url = https://www.slac.stanford.edu/~rkj/crazytime.txt | title = Why is Wednesday, November 17, 1858 the base time for OpenVMS (VAX VMS)? | access-date = 2020-01-08 | date = 1997-07-24 | website = Stanford University | archive-url = https://web.archive.org/web/19970724202734/https://www.slac.stanford.edu/~rkj/crazytime.txt | archive-date = 1997-07-24 | df = dmy-all | url-status = live}}

{{man|sh|gettimeofday|SUSinline}}()

| 1 μs{{cite web|url=https://vmssoftware.com/docs/VSI_CRTL_REF.pdf|title=VSI C Run-Time Library Reference Manual for OpenVMS Systems|date=November 2020|publisher=VSI|access-date=2021-04-17}}

| rowspan="2" |1 January 1970 to 7 February 2106{{cite web|url=https://www.zx.net.nz/mirror/h71000.www7.hp.com/2038.html|title=OpenVMS and the year 2038|publisher=HP|access-date=2021-04-17}}

{{man|sh|clock_gettime|SUSinline}}()

| 1 ns

rowspan="2" | z/OS

| {{code|STCK}}{{cite book|url=http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/download/A2278325.pdf?DT=20070807125005&XKS=DZ9ZBK07|title=z/Architecture Principles of Operation|location=Poughkeepsie, New York|publisher=International Business Machines|date=2007}}{{rp|7–187}}

| rowspan="2"|2−12 μs
244.14 ps{{rp|4-45, 4-46}}

| 1 January 1900 to 17 September 2042 UTIBM intends to extend the date range on future systems beyond 2042. [http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/download/A2278325.pdf?DT=20070807125005&XKS=DZ9ZBK07 z/Architecture Principles of Operation], (Poughkeepsie, New York:International Business Machines, 2007) 1-15, 4-45 to 4-47.

{{code|STCKE}}

| 1 January 1900 to AD 36,765{{cite web|url=https://www.ibm.com/docs/en/zos/2.4.0?topic=addressing-expanded-64-bit-time-values|title=Expanded 64-bit time values|publisher=IBM|access-date=2021-04-18}}

rowspan="3" | Unix, POSIX
(see also C date and time functions)

| {{samp|$}}date (Unix)
time()

| 1 s

| rowspan="3" |(*)
1 January 1970 (to 19 January 2038 prior to Linux 5.9) to 2 July 2486 (Since Linux 5.10)
1 January 1970 to 4 December AD 292,277,026,596

{{man|sh|gettimeofday|SUSinline}}()

| 1 μs

{{man|sh|clock_gettime|SUSinline}}()

| 1 ns

OS/2

| {{code|DosGetDateTime()}}

| 10 ms

| 1 January 1980 to 31 December 2079{{cite web|quote=On OS/2 Warp 4, date and time can both operate well beyond the year 2000, and even well beyond the year 2038, and in fact up to the year 2079, which is the limit for OS/2 Warp 4's real-time clock.|url=https://jdebp.eu/Softwares/cmd.html|title=The 32-bit Command Interpreter|author=Jonathan de Boyne Pollard}}

rowspan="3" | Windows

| {{code|GetSystemTime()}}

| 1 ms

| rowspan="3" |1 January 1601 to 14 September 30828, 02:48:05.4775807

{{code|GetSystemTimeAsFileTime()}}

| rowspan="2" | 100 ns

{{code|GetSystemTimePreciseAsFileTime()}}

=Programming languages and applications=

class="wikitable" style="width:98%; background:#F0F0E7"
style="background:#E0E0E0; width:25%" |Language/Application

! style="background:#E0E0E0; width:30%" |Function or variable

! style="background:#E0E0E0; width:15%" |Resolution

! style="background:#E0E0E0; width:30%" |Epoch or range

Ada

| {{code|Ada.Calendar.Clock}}

| 100 μs to
20 ms (*)

| 1 January 1901 to 31 December 2099 (*)

AWK

| {{code|systime()}}

| 1 s

| (*)

BASIC, True BASIC

| {{code|DATE}}, {{code|DATE$}}
{{code|TIME}}, {{code|TIME$}}

| 1 s

| (*)

Business BASIC

| {{code|DAY}}, {{code|TIM}}

| 0.1 s

| (*)

C (see C date and time functions)

| time()

| 1 s (*)The C standard library does not specify any specific resolution, epoch, range, or datatype for system time values. The C++ library encompasses the C library, so it uses the same system time implementation as C.

| (*)

C++

| {{code|std::time()}}
{{code|std::chrono::system_clock::now()}}

| 1 s (*)
1 ns (C++11, OS dependent)

| (*)

C#

| {{code|System.DateTime.Now}}{{cite web|url=https://docs.microsoft.com/en-us/dotnet/api/system.datetime.now|title=DateTime.Now Property|website=Microsoft Docs}}
{{code|System.DateTime.UtcNow}}{{cite web|url=https://docs.microsoft.com/en-us/dotnet/api/system.datetime.utcnow|title=DateTime.UtcNow Property|website=Microsoft Docs}}

| 100 ns{{cite web|url=https://docs.microsoft.com/en-us/dotnet/api/system.datetime.ticks|title=DateTime.Ticks Property|website=Microsoft Docs}}

| 1 January 0001 to 31 December 9999

CICS

| {{code|ASKTIME}}

| 1 ms

| 1 January 1900

COBOL

| {{code|FUNCTION CURRENT-DATE}}

| 1 s

| 1 January 1601

Common Lisp

| {{code|(get-universal-time)}}

| 1 s

| 1 January 1900

Delphi (Borland)

| {{code|date}}
{{code|time}}

| 1 ms
(floating point)

| 1 January 1900

rowspan="9" | Delphi
(Embarcadero Technologies){{cite web|url=http://docwiki.embarcadero.com/RADStudio/XE4/en/Date_and_Time_Support|title=Date and Time Support|website=Embarcadero Developer Network|date=2013}}

| {{code|System.SysUtils.Time}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.Time|title=System.SysUtils.Time|website=Embarcadero Developer Network|date=2013}}

| rowspan="6" | 1 ms

| rowspan="2" | 0/0/0000 0:0:0:000 to
12/31/9999 23:59:59:999 [sic]

{{code|System.SysUtils.GetTime}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.GetTime|title=System.SysUtils.GetTime|website=Embarcadero Developer Network|date=2013}} (alias for {{code|System.SysUtils.Time}})
{{code|System.SysUtils.Date}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.Date|title=System.SysUtils.Date|website=Embarcadero Developer Network'|date=2013}}

| rowspan="4" | 0/0/0000 0:0:0:000 to
12/31/9999 0:0:0:000 [sic]

{{code|System.DateUtils.Today}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.DateUtils.Today|title=System.DateUtils.Today|website=Embarcadero Developer Network|date=2013}}
{{code|System.DateUtils.Tomorrow}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.DateUtils.Tomorrow|title=System.DateUtils.Tomorrow|website=Embarcadero Developer Network|date=2013}}
{{code|System.DateUtils.Yesterday}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.DateUtils.Yesterday|title=System.DateUtils.Yesterday|website=Embarcadero Developer Network|date=2013}}
{{code|System.SysUtils.Now}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.Now|title=System.SysUtils.Now|website=Embarcadero Developer Network|date=2013}}

| 1 s

| 0/0/0000 0:0:0:000 to
12/31/9999 23:59:59:000 [sic]

{{code|System.SysUtils.DayOfWeek}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.DayOfWeek|title=System.SysUtils.DayOfWeek|website=Embarcadero Developer Network|date=2013}}

| 1 day

| 1 to 7

{{code|System.SysUtils.CurrentYear}}{{cite web|url=http://docwiki.embarcadero.com/Libraries/XE4/en/System.SysUtils.CurrentYear|title=System.SysUtils.CurrentYear|website=Embarcadero Developer Network|date=2013}}

| 1 year

| (*)

Emacs Lisp

| {{code|(current-time)}}

| 1 μs (*)

| 1 January 1970

Erlang

| [http://erlang.org/doc/man/erlang.html#system_time-0 {{code|erlang:system_time()}}], [http://erlang.org/doc/man/os.html#system_time-0 {{code|os:system_time()}}]{{cite web|url=https://www.erlang.org/doc/apps/erts/time_correction.html|title=Time and Time Correction in Erlang|website=www.erlang.org}}

| OS dependent, e.g. on Linux 1ns

| 1 January 1970

Excel

| {{code|date()}}

| ?

| 0 January 1900{{cite web|quote=In the Microsoft Office Spreadsheet Component, the value 0 evaluates to the date December 30, 1899 and the value 1 evaluates to December 31, 1899. ... In Excel, the value 0 evaluates to January 0, 1900 and the value 1 evaluates to January 1, 1900.|url=http://support.microsoft.com/kb/205719|title=XL2000: Early Dates on Office Spreadsheet Component Differ from Excel|website=Microsoft Support|date=2003|archive-url=https://web.archive.org/web/20071024010448/http://support.microsoft.com/kb/205719|archive-date=24 October 2007}}

rowspan="2" | Fortran

| {{code|DATE_AND_TIME}}
{{code|SYSTEM_CLOCK}}

| (*){{cite web|url=https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-system-clock|title=SYSTEM_CLOCK|work=Intel Fortran Compiler 19.0 Developer Guide and Reference|date=29 April 2019|access-date=23 July 2019}}

{{cite web|url=https://gcc.gnu.org/onlinedocs/gfortran/SYSTEM_005fCLOCK.html|title=SYSTEM_CLOCK — Time function|work=The GNU Fortran Compiler|access-date=27 October 2011}}

| rowspan="2" | 1 January 1970

{{code|CPU_TIME}}

| 1 μs

Go

| {{code|time.Now()}}

| 1 ns

| 1 January 0001

rowspan="2" | Haskell

| {{code|Time.getClockTime}}

| 1 ps (*)

| 1 January 1970 (*)

{{code|Data.Time.getCurrentTime}}

| 1 ps (*)

| 17 November 1858 (*)

rowspan="3" | {{anchor|java}} Java

| {{code|java.util.Date()}}
{{code|System.currentTimeMillis()}}

| 1 ms

| 1 January 1970

{{code|System.nanoTime()}}{{cite web|url=https://docs.oracle.com/javase/6/docs/api/java/lang/System.html#nanoTime()|title=System.nanoTime() method|work=Java Platform, Standard Edition 6: API Specification|date=2015|access-date=23 July 2019}}

| 1 ns

| arbitrary

{{code|Clock.systemUTC()}}{{cite web|url=https://docs.oracle.com/javase/8/docs/api/java/time/Clock.html#systemUTC--|title=Clock.systemUTC() and other methods|work=Java Platform, Standard Edition 8: API Specification|date=2014|access-date=15 January 2015}}

| 1 ns

| arbitrary{{cite web|url=https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html|title=JSR-310 Java Time System|work=Java Platform, Standard Edition 8: API Specification|date=2014|access-date=15 January 2015}}

JavaScript, TypeScript

| {{code|(new Date()).getTime()}}
{{code|Date.now()}}

| 1 ms

| 1 January 1970

Matlab

| {{code|now}}

| 1 s

| 0 January 0000{{cite web|url=http://www.mathworks.com/help/matlab/ref/datenum.html|title=Matlab Help}}

MUMPS

| {{code|$H}} (short for Horology)

| 1 s

| 31 December 1840

rowspan="2" | LabVIEW

| {{code|Tick Count}}

| 1 ms

| 00:00:00.000 1 January 1904

{{code|Get Date/Time in Seconds}}

| 1 ms

| 00:00:00.000 1 January 1904

Objective-C

| {{code|[NSDate timeIntervalSinceReferenceDate]}}

| < 1 ms{{cite web|url=https://developer.apple.com/documentation/foundation/nstimeinterval|work=Apple Developer Documentation|title=NSTimeInterval - Foundation}}

| 1 January 2001 ±10,000 Years

rowspan="2" | OCaml

| {{code|Unix.time()}}

| 1 s

| rowspan="2" | 1 January 1970

{{code|Unix.gettimeofday()}}

| 1 μs

Extended Pascal

| {{code|GetTimeStamp()}}

| 1 s

| (*)

Turbo Pascal

| {{code|GetTime()}}
{{code|GetDate()}}

| 10 ms

| (*)

rowspan="2" | Perl

| {{code|time()}}

| 1 s

| rowspan="2" | 1 January 1970

{{code|Time::HiRes::time}}Douglas Wegscheild, R. Schertler, and Jarkko Hietaniemi, {{cite web|url=https://metacpan.org/module/Time::HiRes|title=Time::HiRes|work=CPAN - Comprehensive Perl Archive Network|date=2011|access-date=27 October 2011}}

| 1 μs

rowspan="2" | PHP

| {{code|time()}}
{{code|mktime()}}

| 1 s

| rowspan="2" | 1 January 1970

{{code|microtime()}}

| 1 μs

PureBasic

| {{code|Date()}}

| 1 s

| 1 January 1970 to 19 January 2038

Python

| {{code|datetime.now().timestamp()}}

| 1 μs (*)

| 1 January 1970

rowspan="2" | RPG

| {{code|CURRENT(DATE)}}, {{code|%DATE}}
{{code|CURRENT(TIME)}}, {{code|%TIME}}

| 1 s

| rowspan="2" | 1 January 0001 to 31 December 9999

{{code|CURRENT(TIMESTAMP)}}, {{code|%TIMESTAMP}}

| 1 μs

Ruby

| {{code|Time.now()}}{{cite web|url=https://docs.ruby-lang.org/en/master/Time.html|title=Time class}}

| 1 μs (*)

| 1 January 1970
(to 19 January 2038 prior to Ruby 1.9.2{{cite web|url=https://www.ruby-lang.org/en/news/2010/08/18/ruby-1-9-2-released/|title=Ruby 1.9.2 is released|author=Yugui|date=18 August 2010|quote=The new 1.9.2 is almost compatible with 1.9.1, except these changes: ... Time is reimplemented. The bug with year 2038 is fixed.}})

Scheme

| {{code|(get-universal-time)}}{{cite web| url=https://edoras.sdsu.edu/doc/mit-scheme-9.2/mit-scheme-ref/Date-and-Time.html |title=MIT/GNU Scheme 9.2: 15.5 Date and Time |date=}}

| 1 s

| 1 January 1900

rowspan="3" | Smalltalk

| {{code|Time microsecondClock}}
{{small|(VisualWorks)}}

| rowspan="3" | 1 s {{small|(ANSI)}}
1 μs {{small|(VisualWorks)}}
1 s {{small|(Squeak)}}

| rowspan="3" | 1 January 1901 (*)

{{code|Time totalSeconds}}
{{small|(Squeak)}}
{{code|SystemClock ticksNowSinceSystemClockEpoch}}
{{small|(Chronos)}}
rowspan="2" | SQL

| rowspan="2" | {{code|CURDATE()}} or {{code|CURRENT DATE}}
{{code|CURTIME()}} or {{code|CURRENT TIME}}
{{code|GETDATE()}} or {{code|GETUTCDATE()}}
{{code|NOW()}} or {{code|CURRENT TIMESTAMP}}
{{code|SYSDATE()}}

| 3 ms

| 1 January 1753 to 31 December 9999 (*)

60 s

| 1 January 1900 to 6 June 2079

Standard ML

| {{code|Time.now()}}

| 1 μs (*)

| 1 January 1970 (*)

rowspan="4" | TCL

| {{code|[clock seconds]}}

| 1 s

| rowspan="3" | 1 January 1970

{{code|[clock milliseconds]}}

| 1 ms

{{code|[clock microseconds]}}

| 1 μs

{{code|[clock clicks]}}

| 1 μs (*)

| (*)

rowspan="2" | Windows PowerShell

| {{code|Get-Date}}{{cite web |url=https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ee176845(v=technet.10) |title=Using the Get-Date Cmdlet |website=Microsoft Docs |date=22 October 2009 |access-date=23 July 2019}}{{cite web |url=https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ee692801(v=technet.10) |title=Windows PowerShell Tip of the Week – Formatting Dates and Times |website=Microsoft Docs |date=26 May 2010 |access-date=23 July 2019}}

| rowspan="2" | 100 ns

| rowspan="2" | 1 January 0001 to 31 December 9999

{{code|[DateTime]::Now}}
{{code|[DateTime]::UtcNow}}
Visual Basic .NET

| {{code|System.DateTime.Now}}
{{code|System.DateTime.UtcNow}}

| 100 ns

| 1 January 0001 to 31 December 9999

See also

Notes

References

{{Reflist|30em}}