[Gambas-user] Different quantities of seconds from UNIX date...

Cristiano Guadagnino criguada at gmail.com
Sat Apr 7 13:04:17 CEST 2018


Charlie, you get a difference between the first and the second statement,
just as Vuott (not between the main and the sub, you misintepreted Vuott
message).
But you get a difference of two hours, whereas Vuott gets a difference of 4.
I do not have time to read the docs, but I suspect TZ is the culprit.

Cris


On Sat, Apr 7, 2018 at 12:19 PM, Charlie Ogier <charlie at cogier.com> wrote:

> Hi Vott,
>
> This produces the same results for me?
>
> *Public Sub Main()*
>
> *   Print CFloat(DateDiff(CDate("01/01/1970"), Now, gb.Second)) *
>
> *   Print CFloat(Date.ToUnixTime(Now))      ' Obviously we have to
> activate "gb.util" Component*
>
> *Print*
> *Two*
>
> *End*
>
> *Public Sub Two()*
>
> *   Print CFloat(DateDiff(CDate("01/01/1970"), Now, gb.Second))   *
>
> *   Print CFloat(Date.ToUnixTime(Now))*
>
> *End*
>
> This produces: -
> 1523088787
> 1523095987
>
> 1523088787
> 1523095987
>
> Charlie
>
>
> On 07/04/18 01:02, vuott at tiscali.it wrote:
>
> Hello,
>
> I do not understand why these two lines do not return the same result.
>
> Public Sub Main()
>
>    Print CFloat(DateDiff(CDate("01/01/1970"), Now, gb.Second))
>
>    Print CFloat(Date.ToUnixTime(Now))      ' Obviously we have to
> activate "gb.util" Component
>
> End
>
>
> So that the two results are identical, I have to add 4 hours !
>
> Public Sub Main()
>
>    Print CFloat(DateDiff(CDate("01/01/1970 04:00:00"), Now, gb.Second))
> '  Here I have to add 4 hours !
>
>    Print CFloat(Date.ToUnixTime(Now))
>
> End
>
>
> regards
> vuott
>
>
> *My system and Gambas:*
> [System]
> Gambas=3.10.90 23e7dec (master)
> OperatingSystem=Linux
> Kernel=4.15.0-13-generic
> Architecture=x86_64
> Distribution=Linux Mint 18.3 Sylvia
> Desktop=CINNAMON
> Theme=Cleanlooks
> Language=it_IT.UTF-8
> Memory=3945M
>
> [Libraries]
> Cairo=libcairo.so.2.11400.6
> DBus=libdbus-1.so.3.14.6
> GStreamer=libgstreamer-0.10.so.0.30.0
> GStreamer=libgstreamer-1.0.so.0.803.0
> GTK+2=libgtk-x11-2.0.so.0.2400.30
> GTK+3=libgtk-3.so.0.1800.9
> OpenGL=libGL.so.1.2.0
> Poppler=libpoppler.so.58.0.0
> QT4=libQtCore.so.4.8.7
> QT5=libQt5Core.so.5.5.1
> SDL=libSDL-1.2.so.0.11.4
> SQLite=libsqlite3.so.0.8.6
>
> [Environment]
> DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wi1D3Cngt9,guid=
> b771a1b43385eb8996e385e65ac78fe9
> DEFAULTS_PATH=/usr/share/gconf/cinnamon.default.path
> DESKTOP_SESSION=cinnamon
> DISPLAY=:0
> GB_GUI=gb.qt4
> GDMSESSION=cinnamon
> GDM_LANG=it
> GNOME_DESKTOP_SESSION_ID=this-is-deprecated
> GTK_MODULES=gail:atk-bridge
> GTK_OVERLAY_SCROLLING=1
> HOME=<home>
> INSIDE_NEMO_PYTHON=
> LANG=it_IT.UTF-8
> LANGUAGE=it
> LOGNAME=<user>
> MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path
> PATH=<home>/bin:<home>/.local/bin:/usr/local/sbin:/usr/
> local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> PWD=<home>
> QT_ACCESSIBILITY=1
> QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
> QT_QPA_PLATFORMTHEME=qgnomeplatform
> QT_STYLE_OVERRIDE=gtk
> SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/
> 1171,unix/<hostname>:/tmp/.ICE-unix/1171
> SHELL=/bin/bash
> SHLVL=0
> SSH_AGENT_PID=1229
> SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
> TZ=:/etc/localtime
> USER=<user>
> XAUTHORITY=<home>/.Xauthority
> XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
> XDG_CURRENT_DESKTOP=X-Cinnamon
> XDG_DATA_DIRS=/usr/share/cinnamon:/usr/share/gnome:<
> home>/.local/share/flatpak/exports/share:/var/lib/
> flatpak/exports/share:/usr/local/share:/usr/share
> XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/<user>
> XDG_RUNTIME_DIR=/run/user/1000
> XDG_SEAT=seat0
> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> XDG_SESSION_DESKTOP=cinnamon
> XDG_SESSION_ID=c1
> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
> XDG_SESSION_TYPE=x11
> XDG_VTNR=7
>
>
>
>
> Con Mobile Open 6 GB hai 6 Giga, 600 minuti e 300 SMS per il tuo
> smartphone a 9€ al mese per sempre. Passa ora a Tiscali Mobile, il nostro
> mese è vero! http://tisca.li/Open6GB0318
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List:https://lists.gambas-basic.org/listinfo/user
>
> Search the list:https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
>
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180407/b053f6e8/attachment-0001.html>


More information about the User mailing list