# Port Time Libraries

**URL:** <https://community.particle.io/t/port-time-libraries/2912>\
**Category:** uncategorized\
**Created:** [February 17, 2014, 2:36am UTC](https://community.particle.io/t/port-time-libraries/2912 "2014-02-17T02:36:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![datasmasher](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@datasmasher](https://community.particle.io/u/datasmasher)\
**Post date:** [February 17, 2014, 2:36am UTC](https://community.particle.io/t/port-time-libraries/2912/1 "2014-02-17T02:36:48Z")

</div>

Hello, I am trying to port the time library from Arduino so that I can use the Spark core to power a new PlotClock I just printed and assembled([http://www.thingiverse.com/thing:248009](http://www.thingiverse.com/thing:248009)). I have most of the code put together, but I am new to programming Arduino’s, so I am unsure how to proceed due to the error. The code uses both server.h and time.h, but time.h is not a library I can import. Here is the error I am seeing (from time.h):

```
Time.cpp:50:34: error: 'tmElements_t' has not been declared
Time.cpp:51:17: error: 'tmElements_t' was not declared in this scope
Time.cpp:51:31: error: 'tm' was not declared in this scope
Time.cpp:56:1: error: 'timeStatus_t' does not name a type
Time.cpp:57:23: error: variable or field 'setSyncProvider' declared void
Time.cpp:57:23: error: 'getExternalTime' was not declared in this scope
In file included from Time.cpp:39:0:
Time.h:139:33: error: 'time_t makeTime(tmElements_t&)' redeclared as different kind of symbol
Time.cpp:51:8: error: previous declaration of 'time_t makeTime'
Time.cpp: In function 'time_t makeTime(tmElements_t&)':
Time.cpp:207:33: error: 'time_t makeTime(tmElements_t&)' redeclared as different kind of symbol
Time.cpp:51:8: error: previous declaration of 'time_t makeTime'
Time.cpp: In function 'void setTime(int, int, int, int, int, int)':
Time.cpp:300:22: error: 'makeTime' cannot be used as a function
make: *** [Time.o] Error 1

```

I was hoping I might be able to pick the collective mind of Spark users to figure out a solution to this problem.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [February 17, 2014, 2:47am UTC](https://community.particle.io/t/port-time-libraries/2912/2 "2014-02-17T02:47:16Z")

</div>

I am working on a new time library for :spark: for at least until the :spark: team gives us access to RTC in CPU.

I didn’t choose to port the Arduino time library because NTP time should always be available on the :spark: core and I felt that the time library lacked some things, such as daylight savings time handling and Arduino-style Strings. While I have used the DS1307-type RTC’s in the past, I don’t think the core needs one.

My new library lets you select the refresh interval for NTP updates and handles the NTP kiss-of-death signal.

I hope to release it very soon–I am currently tracking down a bug in the daylight savings time code.

---

<div class="post-metadata">

**Author:** ![datasmasher](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@datasmasher](https://community.particle.io/u/datasmasher)\
**Post date:** [February 17, 2014, 3:17am UTC](https://community.particle.io/t/port-time-libraries/2912/3 "2014-02-17T03:17:11Z")

</div>

Awesome. It will be good to get this little app working with the hardware. Nice little demo piece.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [February 17, 2014, 4:57pm UTC](https://community.particle.io/t/port-time-libraries/2912/4 "2014-02-17T16:57:28Z")

</div>

I have put this up now-see this thread:

[Real Time Clock Library for Spark](https://community.spark.io/t/real-time-clock-library-for-spark/2925)
