Hello again, pretty simple question this time I would think.

What I'm wanting is to be able to add 5 minutes onto a ttime variable. As what I'm trying to acheive is a queue system. (Time + QueueTime) and (QueueTime := QueueTime + ProductTime)

However I get the basics, just can't seem to find a simple way to add a time of my choice onto an existing time (14:23 + 00:07) if you know what I mean.

Thanks,

I'm not to sure about TTime but I've used TDateTime before and maybe you can do something like this:

var
  Time : TTime;
begin
  Time := Now;
  Time := Time + EncodeTime(0, 5, 0, 0); //Adds 5 minutes to Time
  ShowMessage(TimeToStr(Time));
end;

See EncodeTime: http://www.delphibasics.co.uk/RTL.asp?Name=EncodeTime
I think this is what your trying to achieve, the problem with incrementing time is the format and the way it works, you need to increment time with time variables as opposed to standard integers.

Thanks, has now been solved however...

If ProductSelect.Text = 'Toast ' then
         begin
        time_queue := (time_queue + ((1 / 24 / 60) * 5));
         Edit2.Text := TimetoStr(now + time_queue);
         end;

THIS WORKS, yet when I want to take the 5 minutes off of the time_queue it does not work. Any ideas?

If StringGrid1.Cells[1,1] = 'Toast ' then
         begin
        time_queue := (time_queue - ((1 / 24 / 60) * 5));
         end;

Well you could just do:

If StringGrid1.Cells[1,1] = 'Toast ' then
begin
  time_queue := time_queue - EncodeTime(0, 5, 0, 0);
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.