WebSession.ClientTime returns server time !?!?

I’m facing the following problem : The session “ClientTime” property returns me the web app server time (Standalone mode). Is it normal ? i’m using Xojo 2013 R3.

I just tried this here and it seems to be working correctly. I created a simple project with a single Label on it. In Label.Shown event I have the following code:

dim d as date = session.ClientTime me.Text = d.SQLDateTime

Where in your program are you trying to get the ClientTime?

i’m trying to get it at differents points.

My linux server have 45 seconds behind my client machine.

When i’m doing this :

// Retrieve server date
dim serverTime as new Date

msgbox("Server DateTime : " + serverTime.SQLDateTime + " /  Client DateTime : " + session.ClientTime.SQLDateTime)

It displays me the exact same time.

You can’t reproduce it if you host your webapp on your local machine :slight_smile: (which will obviously exactly the same as your client browser :wink:

But i have workarounded it using a direct call to the javascript date() function to obtain the real browser local time and returned it to Xojo :slight_smile:

Doing something wrong with session.ClientTime ?

I tried it locally using my Mac as the server and my PC set to Hawaii time as the client. Hawaii is 5 hours behind my time, and it worked properly.

It’s possible that you are calling it before it’s getting sent from the browser and it’s defaulting to a new date, so I really need to know where your code is. For instance is it in Session.Open? App.Open?

i have tried it on a simple button in my app (so after session.open and after app.open) … and hosted on my distant dedicated server.

i will try on an empty project maybe.

Ok, so here’s the thing. Session.open May be too early. Try accessing it in the shown event of a control or a web page.

yes but when i push the button … the entire webapp is ready and everything is shown …

Not sure it has something to do with the moment i call it in this case.

Well, if you think you’ve found a bug, file a report in feedback with a sample project that shows the error and we’ll take a look at it.

Yes, it is, still, an error. A Bug. Somthing that schould be corrected in the meantime. This Buggy function costs me until now a lot of time like many other stuffs in xojo. I can not understand stuffs like this wich are not corrected after years. I have in in a button wich is filling a textlabel with the clienttime. And guess what: it IS THE SERVER TIME. Client local, SERVER local.

I can’t find a bug report for ClientTime. Can you create one? Can you share your code?

Xojo is working on Web 2.0, is very important to have all the little bugs/errors/enhancements needed reported.

What does this demo app from Xojocloud show on your client? Should show your client time and the servers time.

I am not seeing a bug This was created with 2019r3

Xojocloud Demo

Here is the code:
Session Open Event(Ctime is a String Property of Session)


Webpage Shown Event

Dim d as New Date

label1.Text=label1.Text + " "+d.SQLDateTime
label2.Text=label2.Text + " "+Session.CTime