[Overview][Constants][Types][Procedures and functions][Variables][Index] | Reference for unit 'Dos' (#rtl)

# GetTime

Return the current time

## Declaration

Source position: dosh.inc line 96

`procedure GetTime(`
`var hour: Word;`
`var minute: Word;`
`var second: Word;`
`var sec100: Word`
`);`

## Description

GetTime returns the system's time. Hour is a on a 24-hour time scale. sec100 is in hundredth of a second.

Remark: | Certain operating systems (such as Amiga), always set the sec100 field to zero.

## Errors

None.

## See also

GetDate |  | Get the current date
SetTime |  | Set system time

## Example

    Program Example3;
    uses Dos;

    { Program to demonstrate the GetTime function. }

    Function L0(w:word):string;
    var
      s : string;
    begin
      Str(w,s);
      if w<10 then
       L0:='0'+s
      else
       L0:=s;
    end;

    var
      Hour,Min,Sec,HSec : word;
    begin
      GetTime(Hour,Min,Sec,HSec);
      WriteLn('Current time');
      WriteLn(L0(Hour),':',L0(Min),':',L0(Sec));
    end.

Documentation generated on: Feb 26 2014