Search code examples
c++cunix-timestamp

Minimal implementation of gmtime algorithm?


Does anyone know of a simple gmtime or ctime implementation without consideration for timezone, no external dependencies, and a non-copyleft license (BSD/MIT/anything proprietary-safe)? Preferably in C, but basically anything that gives me the algorithm in its minimal form would work.

I just need seconds since "Jan 1, 1970 00:00:00" broken down into year, day, month, hr, min, sec. And it's almost time to go home on a Friday so I'm feeling a bit lazy.


Solution

  • Try newlib http://sourceware.org/newlib/ it is a BSD license.

    It is designed for embedded systems, so tends to be quite small and simple.

    Look at Docs -> Timefns to see if ctime or gmtime meet your needs.