System time: Difference between revisions
Content added Content deleted
(wiki formatting) |
(Ada example) |
||
Line 1: | Line 1: | ||
{{task}} |
{{task}} |
||
Output the system time (any units will do as long as they are noted) either by a [[Execute a System Command|system command]] or one built into the language. The system time can be used for debugging, network information, random number seeds, or something as simple as program performance. |
Output the system time (any units will do as long as they are noted) either by a [[Execute a System Command|system command]] or one built into the language. The system time can be used for debugging, network information, random number seeds, or something as simple as program performance. |
||
=={{header|Ada}}== |
|||
The following example displays a date-time stamp. The time zone value is the number of minutes offset from the prime meridian. |
|||
with Ada.Calendar; use Ada.Calendar; |
|||
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; |
|||
with Ada.Calendar.Time_Zones; use Ada.Calendar.Time_Zones; |
|||
with Ada.Text_Io; use Ada.Text_Io; |
|||
procedure System_Time is |
|||
Now : Time := Clock; |
|||
begin |
|||
Put_line(Image(Date => Now, Time_Zone => -7*60)); |
|||
end System_Time; |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |