私の目標は、アイテムが取得 (購入) されてから販売された時点までの有効期限を決定することです。各アイテムには TTL 値が関連付けられています。
私は次のことをやっています:
time_t currentSellingTime;
long currentSystemTime = time(¤tSellingTime); // this gives me epoch millisec of now()
long TTL = <some_value>L;
long BuyingTime = <some_value> // this is also in epoch millsec
if(currentSystemTime > TTL+BuyingTime))
{
//throw exception
// item is expired
}
私の質問は、C++ で 2 つのエポック ミリ秒を合計し、別のエポック ミリ秒と比較する方法です。