Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Loading...
Searching...
No Matches
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/*
6This class is for any use that requires work weeks.
7Read more on work weeks at https://en.wikipedia.org/wiki/ISO_week_date
8Note that we use the US accounting method, in which the 1st of January is always in work week 1.
9for example, 1/1/2022 is a Saturday, so that whole week is work week 1, i.e 26-31/12/2021 are
10actualy in work week 1 of 2022
11*/
12#pragma once
13
14#include <string>
15#include <ctime>
16
17
18namespace utilities {
19namespace time {
20
22{
23 unsigned _year;
24 unsigned _ww; //starts at 1
25
26public:
27 work_week(unsigned year, unsigned ww);
28 work_week( const std::time_t & time );
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
38unsigned 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
42unsigned jdn( unsigned year, unsigned month, unsigned day );
43} // namespace time
44} // namespace utilities
Definition: work-week.h:22
unsigned get_year() const
work_week(const work_week &)=default
work_week(const std::time_t &time)
int operator-(const work_week &ww) const
static work_week current()
unsigned get_work_week() const
work_week(unsigned year, unsigned ww)
unsigned jdn(unsigned year, unsigned month, unsigned day)
unsigned get_work_weeks_since(const work_week &start)
Definition: stabilized-value.h:12