WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: time.h and mp3's  (Read 1834 times)

Offline syntax_error

  • Newbie
  • *
  • Posts: 12
time.h and mp3's
« on: June 25, 2018, 07:08:28 PM »
Hi,

I am trying to write a program using an MP3 player to work with Tinycore.  I am currently working to get: https://github.com/dr-soft/mini_al mp3 header to work, but it calls time structures ether CLOCK_MONOTRONIC or CLOCK_REALTIME both of which are supported on the full Linux time.h, but are missing on the piCore time.h.  Is there any way I can port the existing Linux library into piCore? 

Or if anyone knows any simple and compact mp3/flac/wav library I can use that will compile on piCore (with working player examples would be best) and work with a Pi Zero, it would be greatly appreciated.  Thank you in advance...

_err

Offline TimJ

  • Jr. Member
  • **
  • Posts: 57
Re: time.h and mp3's
« Reply #1 on: June 26, 2018, 03:03:25 AM »
I assume you mean CLOCK_MONOTONIC, I don't understand where the difference comes from but they are defined in my /usr/include/linux/time.h on piCore 9.0.3

Code: [Select]
/*
 * The IDs of the various system clocks (for POSIX.1b interval timers):
 */
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
#define CLOCK_SGI_CYCLE 10 /* Hardware specific */
#define CLOCK_TAI 11

#define MAX_CLOCKS 16
#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
#define CLOCKS_MONO CLOCK_MONOTONIC

/*
 * The various flags for setting POSIX.1b interval timers:
 */
#define TIMER_ABSTIME 0x01

#endif /* _LINUX_TIME_H */

Offline syntax_error

  • Newbie
  • *
  • Posts: 12
Re: time.h and mp3's
« Reply #2 on: June 26, 2018, 05:37:33 PM »
Yes, thank you!  That tcz added exactly what I needed.  Now if I can just figure out how to get linux/time.h to define time instead of the regular include/time.h.  I am unfortunately getting linux/time.h is redefining struct timespec.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: time.h and mp3's
« Reply #3 on: June 26, 2018, 07:49:41 PM »
Hi syntax_error
Try:
Code: [Select]
#include <linux/time.h>

Offline syntax_error

  • Newbie
  • *
  • Posts: 12
Re: time.h and mp3's
« Reply #4 on: June 27, 2018, 05:16:50 PM »
Thanks Rich,

I had to #include <linux/time.h> and set _STRUCT_TIMESPEC #defined to 1 to skip the redefinition.

_err