Music Hub  ..
A session-wide music playback service
utils.cpp
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #include <boost/filesystem.hpp>
19 #include <boost/algorithm/string.hpp>
20 
21 #include <memory>
22 #include <fstream>
23 #include <sstream>
24 
25 #include <cstring>
26 #include <cstdarg>
27 
28 #include "utils.h"
29 
30 namespace media = core::ubuntu::media;
31 
33  struct timespec ts;
34  memset(&ts, 0, sizeof(ts));
35  clock_gettime(CLOCK_MONOTONIC, &ts);
36  return ts.tv_sec * 1000000000LL + ts.tv_nsec;
37 }
38 
40  return GetNowNs() / 1000;
41 }
static uint64_t GetNowNs()
Definition: utils.cpp:32
static uint64_t GetNowUs()
Definition: utils.cpp:39