Skip to main content
17-Peridot
February 16, 2024
Question

AMU - Process Troubleshooter - Timezone

  • February 16, 2024
  • 1 reply
  • 2119 views

I have query with AMU Process Troubleshooter.

 

We have configured AMU Assets with 3 levels of heirarchy.

Site --> Area --> Asset

 

Thingworx hosted with UTC.

Area is configures with UTC-6

AMU is accessing from browser (system time is UTC-6).

 

In Process troubleshooter, I'm selecting a filter "Today" It's take wrong time it seems.

Sathishkumar_C_0-1708103322521.png

System time:

Sathishkumar_C_1-1708103358352.png

 

If I'm selecting filter with "CUSTOM" and selecting larger time range I'm able to see the data.

Sathishkumar_C_2-1708103556140.png

 

How to address the issue?

 

 

1 reply

mstarnaud
16-Pearl
February 19, 2024

Hi Satishkumar

 

This is strange, I tried to reproduce on my test server but it came up fine for me : the Start Time shows me 00:00 because my start-of-day setting is 0, and the End Time is my computer's time for both Today and Custom.

 

I have to ask what version you have. To know this you can go in Composer -> Manage (left menu) -> Installed Extensions -> select MnfgCommon_Extension -> look for the Package Version.

 

Second, I would like you to verify that your database is correctly set to UTC. If it's something else, it leads to some unexpected timezone issues like this. To check this, you can make this SQL query : SELECT GETDATE(), GETUTCDATE(). Both columns should be identical, if they're different then you have the issue. You can also try this query : SELECT CURRENT_TIMEZONE(); but this query doesn't always work depending on SQL version & permissions. I know there's also some UTC-related Thingworx setting required, but I'm much less familiar with that, if what we find today isn't enough then I'll try to get help for this.

 

Third, I want to check if the database is returning the expected results. The first step is to find the EquipmentUid (column Uid in the Equipment table) for one of the equipments having this issue. Then, execute this query (you need to change the 1st line) : 

 

DECLARE @EquipmentUidList NVARCHAR(MAX) = '123456789' -- CHANGE THIS
DECLARE @TimeRangeList NVARCHAR(MAX)
EXEC MnfgCommon_QuickTimeIntervalList_SP
	@op_TimeRangeList = @TimeRangeList OUTPUT,
	@p_QuickTimeIntervalUID = 3, -- 3=Today
	@p_EquipmentUIDList = @EquipmentUidList,
	@p_IsRoundingDown = 0
SELECT	[UID],
		StartTime,
		EndTime
FROM 	OPENJSON(@TimeRangeList, '$')
WITH
(
	[UID]		BIGINT		'$.UID',
	StartTime	DATETIME	'$.StartTime',
	EndTime		DATETIME	'$.EndTime'
)

 

This will return the results for Today, interpreted by the database. I expect the results should be Start=06:00 and End=now+06:00.

17-Peridot
February 22, 2024

Thanks for the detailed information. Here is the required details below for your reference. What might be the issue?

Sathishkumar_C_0-1708571761748.png

Sathishkumar_C_1-1708572037949.png

 

Sathishkumar_C_2-1708572085429.png

 

 

mstarnaud
16-Pearl
February 22, 2024

Well, I was right with my big suspect about the database's timezone. It's a requirement that a lot of people skip in the documentation and it always ends up causing weird time conversion issues like this.

 

To fix it (based on the previous attempts I've seen, I'm still trying to find good documentation on this) : remote desktop on the server that has the database installed on it, and set the Windows Clock's timezone to be UTC. Because SQL uses the server's windows clock timezone as the database's timezone. After doing this, in order for it to take effect you might need to restart the SQL service on that server.

 

After it's fixed, the query 1st query should return identical times and the 2nd query should return "(UTC) Coordinated Universal Time".

 

Because this requirement was missed, I'm scared that the other similar settings were missed on the Thingworx side, there's 1 or 2 settings (that are not the windows clock) that must be set for the Thingworx timezone. But I don't know this part well, I will need help for this section. So I suggest you start trying with the windows clock fix and see if it's enough to fix the issue.