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. Pass Start Time & End Time As String

Pass Start Time & End Time as string

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 Techapirant , 8 November, 2019
Forums
Gurux.DLMS

Hello,

While reading data of profile generic using below command how can i pass start time and end time as string ?
com_readRowsByRange(&con, pg, &startTime.value, &endTime.value);

Profile picture for user Kurumi

Kurumi

7 years ago

Hi,

Hi,

You must convert string to struct tm. This depends on the operating system and compiler, etc..

BR,

Mikko

Techapirant

7 years ago

Hello,

Hello,

I am using gcc compiler and Linux Ubuntu 64 Bit OS
Below is my code I am using but getting error
/* Start Time */
char *global_starttime = "2008-12-10 10:00:00";
struct tm *parsedTime;
int year, month, day, hour, minute, second;
if(sscanf(global_starttime, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second) != EOF){
time_t rawTime;
time(&rawTime);
parsedTime = localtime(&rawTime);
parsedTime->tm_year = year;
parsedTime->tm_mon = month;
parsedTime->tm_mday = day;
parsedTime->tm_hour = hour;
parsedTime->tm_min = minute;
parsedTime->tm_sec = second;
}

/* End Time */
char *global_endtime = "2008-12-11 10:00:00";
struct tm *parsedTime_endtime;
if(sscanf(global_endtime, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second) != EOF){
time_t rawTime;
time(&rawTime);
parsedTime_endtime = localtime(&rawTime);
parsedTime_endtime->tm_year = year;
parsedTime_endtime->tm_mon = month;
parsedTime_endtime->tm_mday = day;
parsedTime_endtime->tm_hour = hour;
parsedTime_endtime->tm_min = minute;
parsedTime_endtime->tm_sec = second;
}

time_init2(&startTime,&parsedTime);
time_init2(&endTime,&parsedTime_endtime);

Error : time_init Assertion 0 failed

Profile picture for user Kurumi

Kurumi

7 years ago

Hi,

Hi,

Change this:
struct tm *parsedTime;
to:
struct tm parsedTime;

and try again.

BR,

Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 11/19/2026 - 10:57
    Gurux.DLMS.Python 1.0.204
  • Thu, 11/19/2026 - 10:12
    gurux.dlms.c 9.0.2611.1901
  • Tue, 10/13/2026 - 12:00
    gurux.dlms.java 4.0.97
  • Tue, 09/22/2026 - 14:02
    Gurux.DLMS.Net 9.0.2609.2201
  • Mon, 09/21/2026 - 10:18
    Gurux.DLMS.Net 9.0.2609.2101

New forum topics

  • Landis E650 meter reading over DLMS
  • class_id = 40, version = 2, pushsetup Unparsed data frame
  • GXObisValueItem entries without MaskSize appear to be interpreted as bit flags
  • CheckedListBox incorrectly selects GXObisValueItem Value=0 for non-zero values
  • UIValueType=TextBox is rendered as CheckedListBox when Values are defined
More

Who's new

  • Sayang
  • q80435762@gmail.com
  • ONCAK
  • Berhasil
  • ratirvivege1979
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin