Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. GXDateTime To DLMS Bytes In Daylight Saving Time

GXDateTime to DLMS bytes in daylight saving time

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By kedros , 3 March, 2017
Forums
Gurux DLMS for Java

Hello,
I work on a smart meter simulator and I have trouble with the DLMS representation of GXDateTime when daylight saving is active. When I initialzie GXDateTime with the date 2017/03/26 03:00:00 CEST, the binary representation is the following
09 0C 07 E1 03 1A 07 01 00 00 00 00 78 80
It is wrong, because the time set to GXDateTime was 03:00, but the binary form contains 01. The sources of gurux.dlms.internal.GXCommon show that 1 hour is always deducted when daylight saving is active.
// If summer time.
if (summertime
|| dt.getStatus().contains(ClockStatus.DAYLIGHT_SAVE_ACTIVE)) {
tm.add(Calendar.HOUR, -1);
}

What is the correct way to initialize the GXDateTime object to get the correct number of hours in the byte form? I use the Europe/Bratislava timezone. Thank you.

Jozef

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

GXDateTime to DLMS bytes in daylight saving time

Hi,

First I want to make sure that are you using UTC or your local calendar? How you initialize GXDateTime?

BR,

Mikko

kedros

9 years 3 months ago

Hi Mikko,

Hi Mikko,

We experience this problem using the following scenario:
The local time is set to 2017/03/26 CEST. We work with local time only.
Next we initialize an OffsetTime object to 03:00:00+02:00
Then an OffsetDateTime is created with the following code

OffsetDateTime offsetDateTime = offsetTime.atDate(LocalDate.now());

The value of offsetDateTime is 2017-03-26 03:00:00+02:00 - so far so good.
Next we create the GXDateTime the following way

GXDateTime gxDateTime = new GXDateTime(Date.from(offsetDateTime.toInstant()));

This instance is then added to an object array and the object array added as a buffer to GXDLMSProfileGeneric.
The conversion to DLMS bytes is executed on profile read request. The GXDateTime is still fine and GXDateTime.toMeterTime().toString() returns the correct value Sun Mar 26 03:00:00 CEST 2017.
But the byte representation just does not seem right. I would like to ask for a little help how to get the right value to the hour field in the binary form. Thank You.

Best wishes,

Jozef

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

GXDateTime to DLMS bytes in daylight saving time

Hi,

We released new version today. 2.0.1. This is fixed.

BR,

Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin