www.beck-ipc.com
www.beck-ipc.comwww.beck-ipc.com  | ImprintImprint
FAQFAQ  | SearchSearch  |
RegisterRegister   |LoginLogin

migrating from SC23

Questions and discussions about the operating system RTOS-LNX and the corresponding C-LIB.

migrating from SC23

Postby Pierre » 06.09.2018, 15:14

hi,
I'm trying to migrate a SC23 RTOS application to SC145 RTOS-LNX.
I've problems with old functions settime, setdate used in my SC23 code :
error: aggregate 'time t' has incomplete type and cannot be defined
struct time t;
aggregate 'date d' has incomplete type and cannot be defined
struct date d;
error: 'setdate' was not declared in this scope
error: 'settime' was not declared in this scope

but these functions appears in the new Documentation RTOS-LNX site (Standard-Lib Extension)....

Even if I could use an ANSI equivalent function (which involves some work), I wonder how to use setdate, setime

thanks

Hello Pierre,

settime() and setdate() should both work in RTOS-LNX. The issue seems to be that those functions are not included in clib.h. I included dos.h where they are directly defined and was able to compile the following without issues:


Code: Select all
#include <dos.h>

int main(void) {
  struct time time_struct;
  struct date date_struct;
  settime(&time_struct);
  setdate(&date_struct);
  return 0;
}


Try including dos.h an see if it resolves your issue. We will look into any possible issues with our inclusions in clib.h and fix any potential bug in the next release.

Regards

Michail G. Etairidis
Michael G. Etairidis
Software Development
Beck IPC GmbH

Re: migrating from SC23

Postby Pierre » 07.09.2018, 08:14

ok, it works with <dos.h>.
I've now the same problem with _strdate and _strtime functions. I've include time.h, the compiler doesn't complains with functions like time() also defined in time.h

Hello Pierre,

_strdate() and _strtime() are not part of the RTOS-LNX API. It could be that they will be implemented in some future release. In the meantime, you can use the glibc strftime() function as an alternative.

An example taken from the manpage of the function:

Code: Select all
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int
main(void)
{
    struct tm tm;
    char buf[255];

   memset(&tm, 0, sizeof(struct tm));
    strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
    strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
    puts(buf);
    exit(EXIT_SUCCESS);
}


https://linux.die.net/man/3/strptime

We will keep you updated about any changes regarding the settime() and setdate() functions.

Regards

Michail G. Etairidis
Michael G. Etairidis
Software Development
Beck IPC GmbH

Return to RTOS-LNX


Who is online

Users browsing this forum: No registered users and 0 guests


cron