internal static string FormatNextOccurrences(TimerSchedule schedule, int count, DateTime?now = null, string functionShortName = null)
        {
            if (schedule == null)
            {
                throw new ArgumentNullException("schedule");
            }

            // If we've got a timer name, format it
            if (functionShortName != null)
            {
                functionShortName = $"'{functionShortName}' ";
            }

            bool isUtc = TimeZoneInfo.Local.HasSameRules(TimeZoneInfo.Utc);
            IEnumerable <DateTime> nextOccurrences = schedule.GetNextOccurrences(count, now);
            StringBuilder          builder         = new StringBuilder();

            builder.AppendLine($"The next {count} occurrences of the {functionShortName}schedule ({schedule}) will be:");
            foreach (DateTime occurrence in nextOccurrences)
            {
                if (isUtc)
                {
                    builder.AppendLine(occurrence.ToUniversalTime().ToString(DateTimeFormat));
                }
                else
                {
                    TimeSpan offset = TimeZoneInfo.Local.GetUtcOffset(occurrence);
                    builder.AppendLine($"{occurrence.ToString(DateTimeFormat)} ({occurrence.ToUniversalTime().ToString(DateTimeFormat)})");
                }
            }

            return(builder.ToString());
        }
        internal static string FormatNextOccurrences(TimerSchedule schedule, int count, DateTime?now = null)
        {
            if (schedule == null)
            {
                throw new ArgumentNullException("schedule");
            }

            bool isUtc = TimeZoneInfo.Local.HasSameRules(TimeZoneInfo.Utc);
            IEnumerable <DateTime> nextOccurrences = schedule.GetNextOccurrences(count, now);
            StringBuilder          builder         = new StringBuilder();

            foreach (DateTime occurrence in nextOccurrences)
            {
                if (isUtc)
                {
                    builder.AppendLine(occurrence.ToUniversalTime().ToString(DateTimeFormat));
                }
                else
                {
                    TimeSpan offset = TimeZoneInfo.Local.GetUtcOffset(occurrence);
                    builder.AppendLine($"{occurrence.ToString(DateTimeFormat)} ({occurrence.ToUniversalTime().ToString(DateTimeFormat)})");
                }
            }

            return(builder.ToString());
        }
        internal static string FormatNextOccurrences(TimerSchedule schedule, int count, DateTime?now = null)
        {
            if (schedule == null)
            {
                throw new ArgumentNullException("schedule");
            }

            IEnumerable <DateTime> nextOccurrences = schedule.GetNextOccurrences(count, now);
            StringBuilder          builder         = new StringBuilder();

            builder.AppendLine(string.Format("The next {0} occurrences of the schedule will be:", count));
            foreach (DateTime occurrence in nextOccurrences)
            {
                builder.AppendLine(occurrence.ToString());
            }

            return(builder.ToString());
        }