localtime & gmtime from time.h

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

These functions are found in the time.h that comes with the SDK. Projects can #include time.h & make calls to these functions without errors from the compiler. The linker seems unable to find these functions as if they've been declared but not somewhere in code. Any ideas where I might find these functions in the SDK?

0 Likes
1 Solution
Anonymous
Not applicable

Hello Paul,

1.  Yes you do have the correct make file

2.  libc cannot be added because it has other dependencies that would not have fit in the ROM/RAM

3.  You will need to find alternative methods to implement the functions that you need in time.h.

Hope this helps.

Sincerely,

JT

View solution in original post

0 Likes
5 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Is this related to the question you asked here: Current Time Service

If so, please update that thread and we will try to address with the developers this week when we meet with them.

0 Likes
Anonymous
Not applicable

not really, it's possible for a project to have a rtc element, a desire to use time.h & not be a project that provides the Current Time Service

0 Likes
asridharan
Employee
Employee
10 comments on KBA 5 comments on KBA First comment on KBA

Not all standard library functions are available in the chip (because they would not have fit in the limited ROM and RAM available in the chip). You could try adding specific libraries to you application, add something like this to your makefile.mk:

EXTRA_LD_FLAGS += -lgcc

or say:

EXTRA_LD_FLAGS += -lm

but I suspect not all libraries can be added. Time functions are a part of the standard library (libc.a), and these are not fully implemented on this platform. BLE Time service is recommended instead, see Apps/watch sample application.

Anonymous
Not applicable

Tried adding either of those lines to the makefile.mk found within my App/project Directory & both cause linking errors. Do I have the right makefile? Are there other changes I should make?

0 Likes
Anonymous
Not applicable

Hello Paul,

1.  Yes you do have the correct make file

2.  libc cannot be added because it has other dependencies that would not have fit in the ROM/RAM

3.  You will need to find alternative methods to implement the functions that you need in time.h.

Hope this helps.

Sincerely,

JT

0 Likes