Mapper
shleap.cc
Go to the documentation of this file.
1 /*Translated by FOR_C, v3.4.2 (-), on 06/07/94 at 17:02:47 */
2 /*FOR_C Options SET: c=2 com=u do=r4 ftn=2ln6k op=iv s=dvn str=l sq=i */
3 #define _POSIX_SOURCE
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <ctype.h>
7 #include <dirent.h>
8 #include <unistd.h>
9 #include <math.h>
10 #include <string.h>
11 #include <fcntl.h>
12 #include <sys/stat.h>
13 #include "shef_structs_external.h"
14 /*---------------------------------------------------------------------
15 
16  NAME
17  SUBROUTINE SHLEAP(LYEAR,LEAP)
18 
19  PURPOSE
20  Determine if the year is a leap year or not.
21 
22  Returns:
23  LEAP = 0 , not a leap year
24  LEAP = 1 , leap year
25 
26  LYAER = 2 digit year, e.g., 1999 = 99, 2010 = 10
27 
28  VERSION and UPDATES
29  1.0 APR 82 Geoffrey M. Bonnin
30  Original Version
31  1.1 JUN 89 David G. Brandon
32  Adapted to QNX NWS Hydromet
33  2.0 MAY 94 David G. Brandon
34  Also Translated to 'C' using FOR_C
35  Alow to check years: 1976 - 2020
36  --------------------------------------------------------------------- */
37 
38 void shleap(lyear, leap)
39 short int *lyear, *leap;
40 {
41  static short int ia, ib, ic;
42  *leap = data_.lcent*100 + *lyear;
43 
44 
45  ia = (*leap - (*leap/4)*4 + 3)/4;
46  ib = (*leap - (*leap/100)*100 + 99)/100;
47  ic = (*leap - (*leap/400)*400 + 399)/400;
48 
49  *leap = 1 - ia + ib - ic; /* LEAP IS 1 IF LEAP YEAR */
50 
51  return;
52 
53 }
54 
55 
56 
struct t_data_ data_
void shleap(lyear, leap) short int *lyear
ib
Definition: shleap.cc:46
ic
Definition: shleap.cc:47
void * leap
Definition: shleap.cc:39
ia
Definition: shleap.cc:45
short int lcent
Definition: shef_structs.h:177