diff --git a/src/NHibernate/Type/AbstractDateTimeType.cs b/src/NHibernate/Type/AbstractDateTimeType.cs index fb19752351..ce530a32ba 100644 --- a/src/NHibernate/Type/AbstractDateTimeType.cs +++ b/src/NHibernate/Type/AbstractDateTimeType.cs @@ -96,8 +96,11 @@ public object Next(object current, ISessionImplementor session) => /// The value to round. /// The resolution in ticks (100ns). /// A rounded . - public static DateTime Round(DateTime value, long resolution) => - value.AddTicks(-(value.Ticks % resolution)); + public static DateTime Round(DateTime value, long resolution) + { + var remainder = value.Ticks % resolution; + return remainder * 2 >= resolution ? value.AddTicks(resolution - remainder) : value.AddTicks(-remainder); + } /// public virtual object Seed(ISessionImplementor session) =>