Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e6b74e

Browse files
author
Michael Meskes
committed
Fixed bug in day of week processing.
1 parent8860510 commit8e6b74e

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,10 @@ Fri Sep 26 17:14:07 CEST 2003
16651665
Fri Oct 3 12:04:57 CEST 2003
16661666

16671667
- Hide Informix datatypes in PostgreSQL built process.
1668+
1669+
Sun Oct 5 13:08:47 CEST 2003
1670+
1671+
- Fixed bug in day of week calculation.
16681672
- Set ecpg version to 3.0.0
16691673
- Set ecpg library to 4.0.0
16701674
- Set pgtypes library to 1.0.0

‎src/interfaces/ecpg/pgtypeslib/datetime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ int
123123
PGTYPESdate_dayofweek(datedDate)
124124
{
125125
/*
126-
* Sunday:0 Monday: 1 Tuesday: 2 Wednesday: 3
126+
* Sunday:0 Monday: 1 Tuesday: 2 Wednesday: 3
127127
* Thursday:4 Friday: 5 Saturday: 6
128128
*/
129-
return6-j2day(dDate+3);
129+
return(int)(dDate+date2j(2000,1,1)+1) %7;
130130
}
131131

132132
void

‎src/interfaces/ecpg/pgtypeslib/dt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ inttm2timestamp(struct tm *, fsec_t, int *, timestamp *);
300300
intDecodeUnits(intfield,char*lowtoken,int*val);
301301
boolClearDateCache(bool,bool,bool);
302302

303-
intj2day(intjd);
304-
305303
boolCheckDateTokenTables(void);
306304

307305
intEncodeDateOnly(structtm*,int,char*,bool);

‎src/interfaces/ecpg/pgtypeslib/dt_common.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -637,17 +637,6 @@ j2date(int jd, int *year, int *month, int *day)
637637
return;
638638
}/* j2date() */
639639

640-
int
641-
j2day(intdate)
642-
{
643-
unsignedintday;
644-
645-
day=date;
646-
day+=1;
647-
day %=7;
648-
return (int)day;
649-
}/* j2day() */
650-
651640
/* DecodeSpecial()
652641
* Decode text string using lookup table.
653642
* Implement a cache lookup since it is likely that dates
@@ -931,7 +920,7 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
931920
/* Backward-compatible with traditional Postgres abstime dates */
932921

933922
day=date2j(tm->tm_year,tm->tm_mon,tm->tm_mday);
934-
tm->tm_wday=j2day(day);
923+
tm->tm_wday=(int) ((day+date2j(2000,1,1)+1) %7);
935924

936925
strncpy(str,days[tm->tm_wday],3);
937926
strcpy((str+3)," ");

‎src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include"dt.h"
1212
#include"pgtypes_timestamp.h"
1313
#include"pgtypes_date.h"
14-
#include"datetime.h"
1514

1615
intPGTYPEStimestamp_defmt_scan(char**,char*,timestamp*,int*,int*,int*,
1716
int*,int*,int*,int*);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp