initial
This commit is contained in:
commit
d81c15bf3a
BIN
.vs/Mk0.Tools.TimeTools/v15/.suo
Normal file
BIN
.vs/Mk0.Tools.TimeTools/v15/.suo
Normal file
Binary file not shown.
0
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/db.lock
Normal file
0
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/db.lock
Normal file
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide
Normal file
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide
Normal file
Binary file not shown.
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-shm
Normal file
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-shm
Normal file
Binary file not shown.
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-wal
Normal file
BIN
.vs/Mk0.Tools.TimeTools/v15/Server/sqlite3/storage.ide-wal
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
25
Mk0.Tools.TimeTools.sln
Normal file
25
Mk0.Tools.TimeTools.sln
Normal file
@ -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
|
48
Mk0.Tools.TimeTools/Mk0.Tools.TimeTools.csproj
Normal file
48
Mk0.Tools.TimeTools/Mk0.Tools.TimeTools.csproj
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{2936250A-9426-4FD3-9F0D-A7A6C0484D43}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Mk0.Tools.TimeTools</RootNamespace>
|
||||||
|
<AssemblyName>Mk0.Tools.TimeTools</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="TimeTools.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
36
Mk0.Tools.TimeTools/Properties/AssemblyInfo.cs
Normal file
36
Mk0.Tools.TimeTools/Properties/AssemblyInfo.cs
Normal file
@ -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")]
|
29
Mk0.Tools.TimeTools/TimeTools.cs
Normal file
29
Mk0.Tools.TimeTools/TimeTools.cs
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
6735e05693a30a113217d271419cde6c54e4d0ce
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
6735e05693a30a113217d271419cde6c54e4d0ce
|
Loading…
Reference in New Issue
Block a user