Skip to content

Instantly share code, notes, and snippets.

@lilith
Created July 10, 2012 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lilith/3080465 to your computer and use it in GitHub Desktop.
Save lilith/3080465 to your computer and use it in GitHub Desktop.
public void SetLastModified(DateTime date)
{
DateTime utcDate = DateTimeUtil.ConvertToUniversalTime(date);
this.UtcSetLastModified(utcDate);
}
private void UtcSetLastModified(DateTime utcDate)
{
utcDate = new DateTime(utcDate.Ticks - utcDate.Ticks % 10000000L);
if (utcDate > DateTime.UtcNow)
{
throw new ArgumentOutOfRangeException("utcDate");
}
if (!this._isLastModifiedSet || utcDate > this._utcLastModified)
{
this.Dirtied();
this._utcLastModified = utcDate;
this._isLastModifiedSet = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment