set 3 last byte of clock

2 posts / 0 new
Last post
set 3 last byte of clock

Hi, I want to set three last byte of meter clock as 00 80 00 , so that deviation and time zone does not apply when I read meter clock.
I use this code :
var tzi= TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id);
var dtNow = DateTime.UtcNow.AddMinutes(tzi.BaseUtcOffset.TotalMinutes);
var clock = new GXDLMSClock("")
Time = new GXDateTime(dtNow) {Skip = DateTimeSkips.Deviation ,Status = ClockStatus.DaylightSavingActive},
Status = ClockStatus.DaylightSavingActive | ClockStatus.Skip,
Deviation = 60,
TimeZone =0,// (int)tzi.BaseUtcOffset.TotalMinutes*(-1),
Enabled = false
clock.UpdateDirty(3, clock.TimeZone);
//clock.UpdateDirty(4, clock.Status);
clock.UpdateDirty(7, clock.Deviation);
clock.UpdateDirty(8, clock.Enabled);
WriteDevice(_device, clock, 0);

but I can't achieve what I want. do you have any Idea ?

Kurumi's picture


You can use Skip value, but it's reset every time when you read the value from the meter.
In your example you are setting skip value before writing the value and deviation is ignored. If you want that last byte is zero you need to set it like this:
Skip = DateTimeSkips.Deviation;
Status = ClockStatus.None;


Mikko Kurunsaari
Gurux Ltd