diff options
author | Karen Martikyan <kamartikyan@gmail.com> | 2020-11-08 22:27:29 +0300 |
---|---|---|
committer | Karen Martikyan <kamartikyan@gmail.com> | 2020-11-08 22:27:29 +0300 |
commit | e1b2a190ad4e530e9dee5ad187480607187a11e8 (patch) | |
tree | 5d1fea6371be7dfde766ee5e4baeaf43dec159f5 /Duplicati/Library | |
parent | 1bc6e20a5794a305b354e5b85c427f1963fb4631 (diff) |
Retrieval of epoch moved to extensions
Diffstat (limited to 'Duplicati/Library')
3 files changed, 16 insertions, 1 deletions
diff --git a/Duplicati/Library/Backend/Telegram/Duplicati.Library.Backend.Telegram.csproj b/Duplicati/Library/Backend/Telegram/Duplicati.Library.Backend.Telegram.csproj index 7e8c7f6c9..f26ce5fd3 100644 --- a/Duplicati/Library/Backend/Telegram/Duplicati.Library.Backend.Telegram.csproj +++ b/Duplicati/Library/Backend/Telegram/Duplicati.Library.Backend.Telegram.csproj @@ -52,6 +52,7 @@ <ItemGroup> <Compile Include="ChannelFileInfo.cs" /> <Compile Include="EncryptedFileSessionStore.cs" /> + <Compile Include="Extensions\SystemExtensions.cs" /> <Compile Include="Extensions\TelegramClientExtensions.cs" /> <Compile Include="StreamReadHelper.cs" /> <Compile Include="TelegramBackend.cs" /> diff --git a/Duplicati/Library/Backend/Telegram/Extensions/SystemExtensions.cs b/Duplicati/Library/Backend/Telegram/Extensions/SystemExtensions.cs new file mode 100644 index 000000000..1b74eef71 --- /dev/null +++ b/Duplicati/Library/Backend/Telegram/Extensions/SystemExtensions.cs @@ -0,0 +1,14 @@ +using System; + +namespace Duplicati.Library.Backend.Extensions +{ + public static class SystemExtensions + { + private static readonly DateTime m_firstDate = new DateTime(1970, 1, 1); + + public static long GetEpochSeconds(this DateTime dateTime) + { + return (long)dateTime.Subtract(m_firstDate).TotalSeconds; + } + } +}
\ No newline at end of file diff --git a/Duplicati/Library/Backend/Telegram/TelegramBackend.cs b/Duplicati/Library/Backend/Telegram/TelegramBackend.cs index 380cd4f7f..77cb021d7 100644 --- a/Duplicati/Library/Backend/Telegram/TelegramBackend.cs +++ b/Duplicati/Library/Backend/Telegram/TelegramBackend.cs @@ -253,7 +253,7 @@ namespace Duplicati.Library.Backend { oldMinDate = newMinDate ?? 0; RetrieveMessages(inputPeerChannel, result, oldMinDate); - newMinDate = result.Min(cfi => (int)cfi.Date.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); + newMinDate = result.Min(cfi => (int)cfi.Date.GetEpochSeconds()); } result = result.Distinct().ToList(); |