Results 1 to 3 of 3

Thread: FormatTime

  1. #1
    Join Date
    Feb 2010
    Location
    On the edge of space
    Posts
    160
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FormatTime

    Only does HH:MM:SS format at the moment, but I can incorporate more formats into it.

    Code:
    function FormatTime(Time : Integer) : String;
    var
      Seconds, Minutes, Hours : Integer;
      StringTime : String;
    begin
      Seconds := Floor(Time / 1000);
      Hours := Floor(Seconds / 3600);
      Minutes := Floor((Seconds - Hours * 3600) / 60);
      Seconds := (Seconds - Hours * 3600) - Minutes * 60;
      if Hours < 10 then
        StringTime := '0' + IntToStr(Hours) + ':'
      else
        StringTime := IntToStr(Hours) + ':';
      if Minutes < 10 then
        Insert('0' + IntToStr(Minutes) + ':', StringTime, Length(StringTime) + 1)
      else
        Insert(IntToStr(Minutes), StringTime, Length(StringTime) + 1);
      if Seconds < 10 then
        Insert('0' + IntToStr(Seconds) + '', StringTime, Length(StringTime) + 1)
      else
        Insert(IntToStr(Seconds), StringTime, Length(StringTime) + 1);
      Result := StringTime;
    end;
    Go easy on me. I'm just trying to contribute.

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    I'm pretty sure this is already made.

  3. #3
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Look in core/Timing.scar.
    lol

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •