FlashGraph-ng
A new frontier in large-scale graph analysis and data mining
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ts_graph.h
1 #ifndef __TS_ALGS_H__
2 #define __TS_ALGS_H__
3 
4 /*
5  * Copyright 2014 Open Connectome Project (http://openconnecto.me)
6  * Written by Da Zheng (zhengda1936@gmail.com)
7  *
8  * This file is part of FlashGraph.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include <boost/date_time/posix_time/posix_time.hpp>
24 
25 #include "vertex.h"
26 
27 namespace fg
28 {
29 
30 const int HOUR_SECS = 3600;
31 const int DAY_SECS = HOUR_SECS * 24;
32 const int MONTH_SECS = DAY_SECS * 30;
33 
34 edge_seq_iterator get_ts_iterator(const page_directed_vertex &v,
35  edge_type type, time_t time_start, time_t time_interval);
36 
37 static inline bool is_time_str(const std::string &str)
38 {
39  struct tm tm;
40  memset(&tm, 0, sizeof(tm));
41  char *ret = strptime(str.c_str(), "%Y-%m-%d", &tm);
42  return ret != NULL;
43 }
44 
45 static inline time_t conv_str_to_time(const std::string &str)
46 {
47  struct tm tm;
48  memset(&tm, 0, sizeof(tm));
49  BOOST_VERIFY(strptime(str.c_str(), "%Y-%m-%d", &tm));
50  tm.tm_isdst = 1;
51  return mktime(&tm);
52 }
53 
54 }
55 
56 #endif
edge_type
Edge type of an edge in the graph.
Definition: vertex.h:43