Files
UVtools/UVtools.Core/Extensions/TimeExtensions.cs
T
Tiago Conceição 2231fdaca3 v2.7.1
* **File formats:**
   * Add a layer height check on file load to prevent load files with more decimal digits than supported to avoid precision errors and bugs
   * Fix a wrong cast causing seconds to miliseconds convertion to be caped to the wrong value
   * Internally if a layer colection was replaced, all new layers will be marked as modified to avoid forgeting and ease the code
* **Tools:**
   * Pixel dimming: Better render quality, it now respects AA better and produce better walls (#172)
   * Elephant foot: It now respects AA better and produce better walls for wall dimming
   * Layer Import: Cancelling the operation while importing layers was permanent supresseing layer properties update when changing a base property
* (Change) PrusaSlicer print profiles: Improved raft height and bottom layer count for better print success, less delamination, shorter time and reduce wear of FEP
* (Scripts): Add operation "Validate" pattern to docs and examples (#172)
2021-03-24 03:25:41 +00:00

40 lines
1.3 KiB
C#

/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
namespace UVtools.Core.Extensions
{
public static class TimeExtensions
{
/// <summary>
/// Converts seconds to milliseconds
/// </summary>
/// <param name="value"></param>
/// <param name="rounding"></param>
/// <returns></returns>
public static float SecondsToMilliseconds(float value, byte rounding = 2) => (float)Math.Round(value * 1000f, rounding);
/// <summary>
/// Converts seconds to milliseconds
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static uint SecondsToMillisecondsUint(float value) => (uint)(value * 1000f);
/// <summary>
/// Converts milliseconds to seconds
/// </summary>
/// <param name="value"></param>
/// <param name="rounding"></param>
/// <returns></returns>
public static float MillisecondsToSeconds(float value, byte rounding = 2) => (float)Math.Round(value / 1000f, rounding);
}
}