Warning, /network/kdeconnect-ios/KDE Connect/KDE Connect/Swift Backend/Date+Extensions.swift is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Lucas Wang <lucas.wang@tuta.io> 0003 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 // 0009 // Date+Extensions.swift 0010 // KDE Connect 0011 // 0012 // Created by Claudio Cambra on 25/5/22. 0013 // 0014 0015 import Foundation 0016 0017 // Date extension to return the UNIX epoche in miliseconds, since KDE Connect uses miliseconds 0018 // UNIX Epoche for all timestamp fields: 0019 // https://stackoverflow.com/questions/40134323/date-to-milliseconds-and-back-to-date-in-swift 0020 extension Date { 0021 var millisecondsSince1970: Int64 { 0022 return Int64((self.timeIntervalSince1970 * 1000.0).rounded()) 0023 } 0024 0025 init(milliseconds: Int64) { 0026 self = Date(timeIntervalSince1970: TimeInterval(milliseconds) / 1000) 0027 } 0028 }