Gaffer contains a time-library containing some simple properties which allow sets of timestamps to be stored on entities and edges. There are two properties:
RBMBackedTimestampSet: When this is created, a TimeBucket is specified, e.g. minute. When a timestamp is added, it is truncated to the nearest start of a bucket (e.g. if the bucket is a minute then the seconds are removed) and then added to the set. Internally the timestamps are stored in a Roaring Bitmap.
BoundedTimestampSet: This is similar to the above set, except that when it is created a maximum size is specified. If the set grows beyond the maximum size, then a random sample of the timestamps of that size is created. This is useful to avoid the size of the set for entities or edges that are very busy growing too large. By retaining a sample, we maintain an indication of when the entity or edge was active, without retaining all the information. The sample is implemented using a ReservoirLongsUnion from the Datasketches library.