ReMAS  1.5
Real-time Musical Accompaniment System
TimeFunctions.h
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright (C) 2017 by "Information Retrieval and Parallel Computing" *
3  * group (University of Oviedo, Spain), "Interdisciplinary Computation *
4  * and Communication" group (Polytechnic University of Valencia, Spain) *
5  * and "Signal Processing and Telecommunication Systems Research" group *
6  * (University of Jaen, Spain) *
7  * Contact: remaspack@gmail.com *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the *
21  * Free Software Foundation, Inc., *
22  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
23  **************************************************************************
24 */
34 #pragma once
35 
36 #ifndef ATIME_H
37 #define ATIME_H
38 
39 #ifndef _POSIX_C_SOURCE
40  #define _POSIX_C_SOURCE 199309L
41 #endif
42 
43 #include <time.h>
44 
45 int msleep(int);
53 int msleep(int milliseconds)
54 {
55  /* = { seconds, nanoseconds } */
56  struct timespec ts_sleep = { milliseconds / 1000, (milliseconds % 1000) * 1000000L };
57 
58  if (nanosleep(&ts_sleep, NULL) < 0) return -11; else return 0;
59 }
60 
61 #endif
int msleep(int)
msleep waits milliseconds
Definition: TimeFunctions.h:53