File: DateTimeUtils.h

package info (click to toggle)
postman 2.1-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,248 kB
  • ctags: 3,249
  • sloc: cpp: 33,376; ansic: 2,014; sh: 768; makefile: 300
file content (71 lines) | stat: -rw-r--r-- 2,061 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
DateTimeUtils.h
*/

#ifndef __DATETIME_UTILS_H
#define __DATETIME_UTILS_H

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <pwd.h>
#include <malloc.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include <syslog.h>
#include <dirent.h>
#include <sys/times.h>                                             
#include <signal.h>

#define NUMBER_MONTHS      12
#define NUMBER_DAYSFORWEEK 7
#define HOURS_INTERVALS    15
#define BEGIN_HOUR_PLAN    7
#define MIN_YEAR           1900
#define MAX_YEAR           2100

typedef struct
  {
  int year, month, day;
  } TRecDate;
       
typedef TRecDate TMatWeek[NUMBER_DAYSFORWEEK];

int CurrentYear (void);
int CurrentMonth (void);
int CurrentDay (void);
int CurrentWeek (void);
bool DateIsToday (int day, int month, int year);
bool IsCorrectDay (int day, int month, int year);
void NextDay (int *day, int *month, int *year);
void PrevDay (int *day, int *month, int *year);
void NextMonth (int *month, int *year);
void PrevMonth (int *month, int *year);
void NextYear (int *year);
void PrevYear (int *year);
void NextWeek (int *initday, int *week, int *month, int *year);
void PrevWeek (int *initday, int *week, int *month, int *year);
int NumWeeksYear (int year);
int NumDaysYear (int year);
int DayOfWeek (long julianDay);
void DaysOfWeek (int initweek, int weeknumber, int month, int year, TMatWeek MatWeek);
int NumberOfWeek (long julianDay);
bool IsLeapYear (int year);
int DaysOfMonth (int amonth, int ayear);
long GregorianToJulian (int day, int month, int year);
void JulianToGregorian (long julianDay, int& day, int& month, int& year);
time_t makeUnixDate (int day, int month, int year);
const char *getLongMonth (int amonth);
const char *getShortMonth (int amonth);
const char *getLongDay (int aday);
const char *getShortDay2 (int aday);    
const char *getShortDay3 (int aday);        
                                                           
#endif