While I was reading a C source code files, I found this declarations. (This source code was written for linux system program. This is very important information)
#include <time.h>
#include <stdio.h>
static timer_t* _interval_timer;
...
At first, I wanted to know more about the 'timer_t'. So I googled 'time.h' to get header information. But, there wasn't any words about 'timer_t', only mentioning about 'time_t'.
In curiosity, I searched and opened 'time.h' c standard library file in my 'mac' computer(as you know, /usr/include folder stores c standard library files.) But this file was same with the previous googled one.
Finally, I turned on my linux os(ubuntu) using virtual machine and opend the 'time.h' in the linux c standard library folder(the folder path is same as OSX). As I expected, 'time.h' file in linux has declaration of timer_t.
I added the code lines which declare the 'timer_t' type below.
#if !defined __timer_t_defined && \
((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t)
# define __timer_t_defined 1
# include <bits/types.h>
/* Timer ID returned by `timer_create'. */
typedef __timer_t timer_t;
My question is this.
Why 'timer_t' is only defined in linux c standard library?
Does this situation commonly happens? I mean, are there any differently defined functions or attributes between different OS?