Hello,

I'm using the Delphi StringList as a buffer to hold data. This data is sent out of a socket when the link is available else the data is stored in the list. As I don't want the list to grow out of control I'm allowing the user to define a maximum size for the list and a life for each entry. The life of an entry is in the range of 1 minute to 24 hours in minute increments, this is a global setting so all items have this limit. I had planned to look at the oldest item on the list every minute and remove it when it exceeds the defined time. My problem is how to best to define when an item is too old and should be removed. My initial thought was that when I add an item to the list I use the current time + the timeout. When I check the first item (which will be the oldest), I check to see if that time is met and remove it. I then check the next item and if that's ok I go back to checking every minute etc. This method isn't good as it will go wrong if the user changes the pc time or the clock changes for daylight saving. What about if I have an internal counter that starts at 0 and is incremented every minute. I could use the above method but use the counter rather than the pc time. Any other ideas ?