Skip to main content
Home
for DLMS smart meters

Main navigation

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

Breadcrumb

  1. Home
  2. Simulator Throws Invalid Date Time Error. Actual Device Works Fine In Director

Simulator Throws Invalid date time error. Actual device works fine in Director

Profile picture for user Frank
By Frank, 31 January, 2025
Forums
Known problems

Console output:
C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\bin\Debug\net8.0>Gurux.DLMS.Simulator.Net.exe -p 1000 -x sim1.xml -t Verbose -N 10
DLMS HDLC Logical Name simulator start in Tcp ports 1000-1009.
String '01/10/1900 00+00:00' was not recognized as a valid DateTime.

My simulator throws this error and I followed the stacktrace. The sim.xml file is from a device that is still currently in development and that i have no control over.

I tried debugging and following the stack trace which is as follows:

DLMS HDLC Logical Name simulator start in Tcp ports 1000-1009.
String '01/10/1900 00+00:00' was not recognized as a valid DateTime.
at Gurux.DLMS.GXDateTime..ctor(String value, CultureInfo culture) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\GXDateTime.cs:line 350
at Gurux.DLMS.Objects.GXXmlReader.ReadElementContentAsDateTime(String name) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXXmlReader.cs:line 318
at Gurux.DLMS.Objects.GXDLMSClock.Gurux.DLMS.Objects.IGXDLMSBase.Load(GXXmlReader reader) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSClock.cs:line 698
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(Stream stream, GXDLMSObjectCollection objects) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 488
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(Stream stream) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 367
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(String filename) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 342
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.LoadObjects(String path, GXDLMSObjectCollection items) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 180
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.Init(Boolean exclusive) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 451
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.Initialize(IGXMedia media, TraceLevel trace, String path, UInt32 sn, Boolean exclusive, GXDLMSObjectCollection sharedObjects) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 133
at Gurux.DLMS.Simulator.Net.Program.StartSimulator(Settings settings) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\Program.cs:line 212
at Gurux.DLMS.Simulator.Net.Program.Main(String[] args) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\Program.cs:line 327

C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\bin\Debug\net8.0\Gurux.DLMS.Simulator.Net.exe (process 14456) exited with code 1 (0x1).

I didn't want to mess too much with the GXDateTime class since my goal right now is to simply run the simulation. Hence this filthy solution... I took a previously accepted value and hardcoded it to overwrite the value that keeps calling the error.

(\Gurux.DLMS.Net-master\Development\GXDateTime.cs:line 171)

public GXDateTime(string value, CultureInfo culture)
: base()
{
if (value == "01/*/1900 00Z")
{
value = $"01/27/2025 07:46:14Z";
}

Worked well enough to run the simulation. But using the actual hardware I never noticed this error using the Director. I thought maybe it was something like ArgumentOutOfRange but I guess not??

Profile picture for user Kurumi

Kurumi

11 months 3 weeks ago

Hi, 01/10/1900 00+00:00 is…

Hi,

01/10/1900 00+00:00 is an invalid date-time for DST Begin time. The minute and second parts are missing. Can you read Begin (attribute #5) with GXDLMSDirector and add your meter reply as a hex? I'll check that the meter returns and if something can be done for this.

BR,
Mikko

Profile picture for user Frank

Frank

11 months 2 weeks ago

this is the output in the…

this is the output in the logs
8:23:42 pm Read object type Clock index: 5
7E A0 19 03 25 BA 4F B7 E6 E6 00 C0 01 C1 00 08 00 00 01 00 00 FF 05 00 68 57 7E
8:23:42 pm
7E A0 1E 25 03 DA 69 21 E6 E7 00 C4 01 C1 00 09 0C 07 6C 01 00 07 00 00 00 00 00 00 00 C6 7F 7E

Profile picture for user Kurumi

Kurumi

11 months 2 weeks ago

Hi, Your meter says that DST…

Hi,

Your meter says that DST started every Sunday in January 1900. Ask if the meter manufacturer has a firmware update that fixes this.

In the mean time you can change this to the XML.
You can use this value: 03/01/* 12:00:00

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87
  • Fri, 12/12/2025 - 08:38
    Gurux.DLMS.Python 1.0.195

New forum topics

  • Generic Profile- gxGet with selector=2: different behaviour on cpp and cimplementation
  • DLMS Client–Server Communication Over GPRS Fails With Dynamic IP
  • Pre-established connection questions
  • writing Error "Service not allowed"
  • High GMAC meters can’t authenticate – can’t read invocation counter
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin