using System;
using System.Globalization;
namespace StellaOps.Provcache;
public sealed partial class ProvcacheOptions
{
///
/// Compute time window epoch from a timestamp based on the configured bucket size.
///
/// The timestamp to compute the epoch for.
/// The epoch identifier string.
public string ComputeTimeWindow(DateTimeOffset timestamp)
{
var bucketTicks = TimeWindowBucket.Ticks;
var epoch = timestamp.UtcTicks / bucketTicks * bucketTicks;
return new DateTimeOffset(epoch, TimeSpan.Zero).ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture);
}
}