commit d81c15bf3ad0f738c4fe5d9a50c88f71ea16754e Author: Manuel Kamper Date: Thu Jul 25 10:31:33 2019 +0200 initial diff --git a/.vs/Mk0.Tools.TimeTools/v15/.suo b/.vs/Mk0.Tools.TimeTools/v15/.suo new file mode 100644 index 0000000..2953ac4 Binary files /dev/null and b/.vs/Mk0.Tools.TimeTools/v15/.suo differ diff --git a/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/db.lock b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..56758a8 Binary files /dev/null and b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-shm b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..bfae23c Binary files /dev/null and b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-wal b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..22dcb07 Binary files /dev/null and b/.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-wal differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..c9948a1 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/Mk0.Tools.TimeTools.sln b/Mk0.Tools.TimeTools.sln new file mode 100644 index 0000000..ab8b1a3 --- /dev/null +++ b/Mk0.Tools.TimeTools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.757 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mk0.Tools.TimeTools", "Mk0.Tools.TimeTools\Mk0.Tools.TimeTools.csproj", "{2936250A-9426-4FD3-9F0D-A7A6C0484D43}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2936250A-9426-4FD3-9F0D-A7A6C0484D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2936250A-9426-4FD3-9F0D-A7A6C0484D43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2936250A-9426-4FD3-9F0D-A7A6C0484D43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2936250A-9426-4FD3-9F0D-A7A6C0484D43}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6E91673C-AC57-4D9B-A2DD-EE0FAA5FC043} + EndGlobalSection +EndGlobal diff --git a/Mk0.Tools.TimeTools/Mk0.Tools.TimeTools.csproj b/Mk0.Tools.TimeTools/Mk0.Tools.TimeTools.csproj new file mode 100644 index 0000000..d43c284 --- /dev/null +++ b/Mk0.Tools.TimeTools/Mk0.Tools.TimeTools.csproj @@ -0,0 +1,48 @@ + + + + + Debug + AnyCPU + {2936250A-9426-4FD3-9F0D-A7A6C0484D43} + Library + Properties + Mk0.Tools.TimeTools + Mk0.Tools.TimeTools + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Mk0.Tools.TimeTools/Properties/AssemblyInfo.cs b/Mk0.Tools.TimeTools/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..91fd0f8 --- /dev/null +++ b/Mk0.Tools.TimeTools/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Mk0.Tools.TimeTools")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Mk0.Tools.TimeTools")] +[assembly: AssemblyCopyright("Copyright © 2019 mk0.at")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("2936250a-9426-4fd3-9f0d-a7a6c0484d43")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Mk0.Tools.TimeTools/TimeTools.cs b/Mk0.Tools.TimeTools/TimeTools.cs new file mode 100644 index 0000000..b94ef1e --- /dev/null +++ b/Mk0.Tools.TimeTools/TimeTools.cs @@ -0,0 +1,29 @@ +using System; + +namespace Mk0.Tools.TimeTools +{ + public static class TimeTools + { + public static DateTime RoundUp(this DateTime dt, TimeSpan d) + { + var modTicks = dt.Ticks % d.Ticks; + var delta = modTicks != 0 ? d.Ticks - modTicks : 0; + return new DateTime(dt.Ticks + delta, dt.Kind); + } + + public static DateTime RoundDown(this DateTime dt, TimeSpan d) + { + var delta = dt.Ticks % d.Ticks; + return new DateTime(dt.Ticks - delta, dt.Kind); + } + + public static DateTime RoundToNearest(this DateTime dt, TimeSpan d) + { + var delta = dt.Ticks % d.Ticks; + bool roundUp = delta > d.Ticks / 2; + var offset = roundUp ? d.Ticks : 0; + + return new DateTime(dt.Ticks + offset - delta, dt.Kind); + } + } +} diff --git a/Mk0.Tools.TimeTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Mk0.Tools.TimeTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..e8f6275 Binary files /dev/null and b/Mk0.Tools.TimeTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache b/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..1d0f18e --- /dev/null +++ b/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +6735e05693a30a113217d271419cde6c54e4d0ce diff --git a/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csprojAssemblyReference.cache b/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csprojAssemblyReference.cache new file mode 100644 index 0000000..8bb75ee Binary files /dev/null and b/Mk0.Tools.TimeTools/obj/Debug/Mk0.Tools.TimeTools.csprojAssemblyReference.cache differ diff --git a/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Mk0.Tools.TimeTools/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/Mk0.Tools.TimeTools/obj/Release/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache b/Mk0.Tools.TimeTools/obj/Release/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..1d0f18e --- /dev/null +++ b/Mk0.Tools.TimeTools/obj/Release/Mk0.Tools.TimeTools.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +6735e05693a30a113217d271419cde6c54e4d0ce