dt.c.patch

text/plain

Filename: dt.c.patch
Type: text/plain
Part: 0
Message: Re: [BUGS] Date calc bug

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/utils/adt/dt.c 11 7
*** ../src/backend/utils/adt/dt.c.orig	Mon Jan  3 08:27:24 2000
--- ../src/backend/utils/adt/dt.c	Mon Jan  3 16:41:08 2000
***************
*** 787,792 ****
--- 787,793 ----
   * To add a month, increment the month, and use the same day of month.
   * Then, if the next month has fewer days, set the day of month
   *	to the last day of month.
+  * Lastly, add in the "quantitative time".
   */
  DateTime   *
  datetime_pl_span(DateTime *datetime, TimeSpan *span)
***************
*** 815,826 ****
  	{
  		dt = (DATETIME_IS_RELATIVE(*datetime) ? SetDateTime(*datetime) : *datetime);
  
- #ifdef ROUND_ALL
- 		dt = JROUND(dt + span->time);
- #else
- 		dt += span->time;
- #endif
- 
  		if (span->month != 0)
  		{
  			struct tm	tt,
--- 816,821 ----
***************
*** 853,858 ****
--- 848,859 ----
  				DATETIME_INVALID(dt);
  		}
  
+ #ifdef ROUND_ALL
+ 		dt = JROUND(dt + span->time);
+ #else
+ 		dt += span->time;
+ #endif
+ 
  		*result = dt;
  	}
  
***************
*** 2441,2447 ****
  tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
  {
  	span->month = ((tm->tm_year * 12) + tm->tm_mon);
! 	span->time = ((((((tm->tm_mday * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60) + tm->tm_sec);
  	span->time = JROUND(span->time + fsec);
  
  	return 0;
--- 2442,2451 ----
  tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
  {
  	span->month = ((tm->tm_year * 12) + tm->tm_mon);
! 	span->time = ((((((tm->tm_mday * 24.0)
! 					 + tm->tm_hour) * 60.0)
! 					 + tm->tm_min) * 60.0)
! 					 + tm->tm_sec);
  	span->time = JROUND(span->time + fsec);
  
  	return 0;