logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementRevisionClock

    Stamps every achievement write with a strictly increasing revision, so the store's upsert-if-better comparison always recognizes the newest write as the winner.

    Inheritance
    object
    AchievementRevisionClock
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Domain.Services
    Assembly: Serenity.Achievements.Domain.dll
    Syntax
    public static class AchievementRevisionClock
    Remarks

    Wall-clock ticks alone are not enough: two writes inside the same tick, or a clock that steps backwards, would both produce a revision the store refuses. Taking the larger of "one past the last known revision" and "now" keeps the sequence monotonic under either condition while still reading as a timestamp in the common case.

    Methods

    Next(long, long)

    Returns the next revision to stamp a write with.

    Declaration
    public static long Next(long lastKnownRevision, long utcNowTicks)
    Parameters
    Type Name Description
    long lastKnownRevision

    The revision the row currently carries, or zero when it is new.

    long utcNowTicks

    The current UTC time in ticks.

    Returns
    Type Description
    long

    A revision strictly greater than lastKnownRevision.

    In this article
    © 2026 Serenity. All Rights Reserved