Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: syntax_error on June 25, 2018, 04:08:28 PM

Title: time.h and mp3's
Post by: syntax_error on June 25, 2018, 04: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 (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
Title: Re: time.h and mp3's
Post by: TimJ on June 26, 2018, 12: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 */
Title: Re: time.h and mp3's
Post by: syntax_error on June 26, 2018, 02: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.
Title: Re: time.h and mp3's
Post by: Rich on June 26, 2018, 04:49:41 PM
Hi syntax_error
Try:
Code: [Select]
#include <linux/time.h>
Title: Re: time.h and mp3's
Post by: syntax_error on June 27, 2018, 02:16:50 PM
Thanks Rich,

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

_err