Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
9fbfab33
Commit
9fbfab33
authored
27 years ago
by
Mirar (Pontus Hagland)
Browse files
Options
Downloads
Patches
Plain Diff
week bugfix
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.2
parent
fd7e3e52
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Calendar.pmod/Gregorian.pmod
+18
-11
18 additions, 11 deletions
lib/modules/Calendar.pmod/Gregorian.pmod
with
18 additions
and
11 deletions
lib/modules/Calendar.pmod/Gregorian.pmod
+
18
−
11
View file @
9fbfab33
...
...
@@ -124,12 +124,12 @@ class Year
object next()
{
return vYear(y);
return vYear(y
+1
);
}
object prev()
{
return vYear(y);
return vYear(y
-1
);
}
object `+(int n)
...
...
@@ -214,7 +214,7 @@ class Year
if (n<0)
return vMonth(y,13+n);
else
return vMonth(y,n);
return vMonth(y,n
||1
);
}
array(mixed) months()
...
...
@@ -225,7 +225,7 @@ class Year
object week(int n)
{
if (n<0)
return vWeek(y,this->number_of_weeks+n+1);
return vWeek(y,this->number_of_weeks
()
+n+1);
else
return vWeek(y,n||1);
}
...
...
@@ -308,10 +308,17 @@ class Month
int `==(object x)
{
return
objectp(x) &&
object_program(x)==object_program(this) &&
x->y==y && x->m==m;
}
int `!=(object x)
{
write("foo\n");
return !(this==x);
}
int `>(object x)
{
return
...
...
@@ -516,7 +523,7 @@ class Week
int yday()
{
return
({-1,-2,-3,
-4,5,6,7
})[this->year()->julian_day(0)%7]
({
0,
-1,-2,-3,
3,2,1
})[this->year()->julian_day(0)%7]
+7*(w-1);
}
...
...
@@ -564,10 +571,10 @@ class Week
if (n<0) n=8+n;
else if (!n) n=1;
n+=yday()-1;
if (n<0) return vYear(y-1)->day(n
+1
);
if (n
+1
>this->year()->number_of_days())
if (n<0) return vYear(y-1)->day(n);
if (n>
=
this->year()->number_of_days())
return vYear(y+1)->day(n-this->year()->number_of_days());
return vDay(y,n
+1
);
return vDay(y,n);
}
array(mixed) days()
...
...
@@ -746,11 +753,11 @@ class Day
{
int n;
object ye=this->year();
n=(-({-1,-2,-3,
-4,5,6,7
})[this->year()->julian_day(0)%7]+d
-1
)/7+1;
n=(-({
0,
-1,-2,-3,
3,2,1
})[this->year()->julian_day(0)%7]+d)/7+1;
if (n>ye->number_of_weeks())
return
vWeek(y+1,
1);
return
ye->next()->week(
1);
else if (n<=0)
return
vWeek(y-1,
ye->prev()->
number_of_
week
s()
);
return ye->prev()->week
(-1
);
return vWeek(y,n);
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment