unit Defs;
// (C) by Marco Schulze <marco@nightlabs.com>
// [YMD] 2001-03-07
// published under GPL (GNU Public Licence)

interface
uses IniFiles;

type
  TStringArray = Array of String;
  TCharArray   = Array of Char;

function HourMinStrToSecs(const S:String):Integer;
function SecsToHourMinStr(Secs:Integer):String;

var
  IniFile : TIniFile;

implementation

uses SysUtils;

function HourMinStrToSecs(const S:String):Integer;
var
  i          : Integer;
  MinS, SecS : String;
const
  Sep = ':';
begin
  i:=Pos(Sep,S);
  MinS:=Copy(S,1,i-1);
  SecS:=Copy(S,i+1,Length(S));

  i:=Pos(#0,SecS);
  if i<1 then i:=Length(s);
  SetLength(SecS,i);
  Result:=StrToInt(MinS)*60 + StrToInt(SecS);
end;

function SecsToHourMinStr(Secs:Integer):String;
const
  Sep = ':';
begin
  Result:=
    FormatFloat('00',Secs div 60)+
    Sep+
    FormatFloat('00',Secs mod 60);
end;

end.
