public void Write(IReadOnlyDictionary <string, object?> logData)
        {
            logData.TryGetValue(_options.DateTimeKey, out var time);

            _queue?.Enqueue(new BufferedLog(time switch
            {
#if NET6_0_OR_GREATER
                TimeOnly t => DateTimeOffset.Now.Date + t.ToTimeSpan(),
#endif
                DateTime dt => new DateTimeOffset(dt),
                DateTimeOffset dto => dto,
                _ => DateTimeOffset.Now,
            }, logData));
Example #2
0
 public static string ToExcelTime(TimeOnly timeOnly)
 {
     return(timeOnly.ToTimeSpan().TotalDays.ToString(CultureInfo.InvariantCulture));
 }