From ec834b36a378fae321f52490fae4a31fb1910b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 3 May 2017 23:56:25 +0000 Subject: [PATCH] [GB.UTIL] * NEW: Compute Date.ToUnixTime() with System.TimeZone. git-svn-id: svn://localhost/gambas/trunk@8133 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.util/.src/Date.module | 2 +- comp/src/gb.util/.src/MMain.module | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/comp/src/gb.util/.src/Date.module b/comp/src/gb.util/.src/Date.module index c88537441..ddfc4092a 100644 --- a/comp/src/gb.util/.src/Date.module +++ b/comp/src/gb.util/.src/Date.module @@ -6,7 +6,7 @@ Private $aMonth As String[] Public Sub ToUnixTime({Date} As Date) As Long - Return DateDiff(Date(1970, 1, 1), {Date} - Frac(Date(Now)), gb.Second) + Return DateDiff(Date(1970, 1, 1), {Date}, gb.Second) + System.TimeZone End diff --git a/comp/src/gb.util/.src/MMain.module b/comp/src/gb.util/.src/MMain.module index c803f8892..d5d3e72d4 100644 --- a/comp/src/gb.util/.src/MMain.module +++ b/comp/src/gb.util/.src/MMain.module @@ -2,6 +2,11 @@ Public Sub Main() - Print Date.ToRFC822(Date.FromRFC822("23 Apr 17 19:55:10 +0200"), "-0100") + 'Print Date.ToRFC822(Date.FromRFC822("23 Apr 17 19:55:10 +0200"), "-0100") + + Dim sEpochSeconds As String + Shell "date +%s" To sEpochSeconds + Print Trim(sEpochSeconds) + Print Date.ToUnixTime(Now) End