Skip to content
Snippets Groups Projects
Commit 61378e59 authored by Rahul Sinha's avatar Rahul Sinha
Browse files

Bug #4966: Speed julianDeltaToTimeDelta()

parent a4949eb8
No related branches found
No related tags found
No related merge requests found
......@@ -805,6 +805,16 @@ julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime* base_dt, struc
int64_t j = base_dt->date.year;
/* Initialize to 0. */
td_return->year = 0;
/* Fast-Fwd: >= 400 */
while (days >= NO_OF_DAYS_IN_400_YEARS)
{
td_return->year = td_return->year + 400;
j = j + 400;
days = days - NO_OF_DAYS_IN_400_YEARS;
};
do
{
......@@ -895,6 +905,16 @@ julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime* base_dt, struc
int64_t j = base_dt->date.year;
/* Initialize. */
td_return->year = 0;
/* Fast-Fwd: >= 400 */
while (days >= NO_OF_DAYS_IN_400_YEARS)
{
td_return->year = td_return->year + 400;
j = j - 400;
days = days - NO_OF_DAYS_IN_400_YEARS;
};
do
{
/* Loop over and get the year by substracting 366/365 days depending
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment