Chromatics.Chromatics.calculateWeatherVar C# (CSharp) Method

calculateWeatherVar() private method

private calculateWeatherVar ( ) : int
return int
        private int calculateWeatherVar()
        {
            var unixSeconds = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

            // Get Eorzea hour for weather start
            var bell = unixSeconds / 175;

            // Do the magic 'cause for calculations 16:00 is 0, 00:00 is 8 and 08:00 is 16
            var increment = ((bell + 8) - (bell % 8)) % 24;

            // Take Eorzea days since unix epoch
            var totalDays = unixSeconds / 4200;

            totalDays = ((int)(uint)totalDays << 32) >> 0; // Convert to uint

            // 0x64 = 100
            var calcBase = totalDays * 100 + increment;

            // 0xB = 11
            var step1 = (calcBase << 11) ^ calcBase;
            var step2 = ((int)(uint)step1 >> 8) ^ step1;

            // 0x64 = 100
            return step2 % 100;
        }
Chromatics