// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using System;

namespace Atom.Core.Extensions
{
    public static class DateTimeExtentions
    {
        public static int Shift(this DateTime value, bool neverIfNull = false)
        {
            var Value = 0;

            Value |= value.Minute << 25;
            Value |= (value.Hour & 0x3F) << 19;
            Value |= (value.Day & 0x3F) << 13;
            Value |= (value.Month & 0x1F) << 8;
            Value |= (byte)(value.Year - 2000);

            return neverIfNull && Value == 0 ? 1992027391 : Value;
        }
    }
}
