Amazon.TraceListener.DynamoDBTraceListener.GetCurrentTimestamp C# (CSharp) Method

GetCurrentTimestamp() private method

private GetCurrentTimestamp ( ) : System.DateTime
return System.DateTime
        private DateTime GetCurrentTimestamp()
        {
            DateTime now = DateTime.Now;
            // DateTime is converted to an ISO 8601 string with millisecond precision,
            // so we may need to avoid range key collisions by incrementing the date by a millisecond
            lock (generalLock)
            {
                var diff = (now - lastTimestamp);
                if (diff.TotalMilliseconds < 1)
                    now = lastTimestamp + oneMillisecond;
                lastTimestamp = now;
            }
            return now;
        }