work_week.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 
5 /*
6 This class is for any use that requires work weeks.
7 Read more on work weeks at https://en.wikipedia.org/wiki/ISO_week_date
8 Note that we use the US accounting method, in which the 1st of January is always in work week 1.
9 for example, 1/1/2022 is a Saturday, so that whole week is work week 1, i.e 26-31/12/2021 are
10 actualy in work week 1 of 2022
11 */
12 #pragma once
13 
14 #include <string>
15 #include <ctime>
16 
17 
18 namespace utilities {
19 namespace time {
20 
21 class work_week
22 {
23  unsigned _year;
24  unsigned _ww; //starts at 1
25 
26 public:
27  work_week(unsigned year, unsigned ww);
28  work_week( const std::time_t & time );
29  static work_week current();
30  work_week(const work_week & ) = default;
31 
32  unsigned get_year() const;
33  unsigned get_work_week() const;
34  int operator-( const work_week & ww ) const;
35 };
36 
37 // Returns the number of work weeks since given time
38 unsigned get_work_weeks_since( const work_week & start );
39 
40 // Calulates and returns the Julian day number of the given date.
41 //read more in https://en.wikipedia.org/wiki/Julian_day
42 unsigned jdn( unsigned year, unsigned month, unsigned day );
43 } // namespace time
44 } // namespace utilities
unsigned get_year() const
Definition: work_week.cpp:72
GLuint start
unsigned get_work_weeks_since(const work_week &start)
Definition: work_week.cpp:93
work_week(unsigned year, unsigned ww)
Definition: work_week.cpp:40
int operator-(const work_week &ww) const
Definition: work_week.cpp:82
static work_week current()
Definition: work_week.cpp:87
unsigned get_work_week() const
Definition: work_week.cpp:77
unsigned jdn(unsigned year, unsigned month, unsigned day)
Definition: work_week.cpp:101


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:23