{"action":"created","comment":{"url":"https://api.github.com/repos/privat/nit/pulls/comments/30739274","id":30739274,"diff_hunk":"@@ -0,0 +1,215 @@\n+# This file is part of NIT ( http://www.nitlanguage.org ).\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+# The date and time behavior is splited in 2 classes:\n+# * `Date` handles the year, month and day part of the date.\n+# * `Time` handles the time in hour, minute and second.\n+# \n+# These are extended by DateTime that merges the two concepts in one class.\n+#\n+#\t###################\n+#\t# Some operations #\n+#\t###################\n+#\n+#\t#DateTime:\n+#\tvar date_1  = new DateTime(2014, 02, 09, 13, 50, 0)\n+#\tvar date_2  = new DateTime(2014, 02, 09, 13, 51, 0)\n+#\t\n+#\tassert date_1 > date_2\n+# \t\n+#\t#Date:\n+#\tvar date_1 = new Date(2014, 01, 12)\n+#\tvar date_2 = new Date(2014, 01, 30)\n+#\t\n+#\tassert date_1.diff_month(date_2)\n+#\n+#\t#Time:\n+#\tvar time_1 = new Time.now\n+#\tvar time_2 = new Time(14,25,30)\n+#\t\n+#\tassert time_1 == time_2\n+#\n+module date\n+\n+# The class \"Time\" allow the manipulation only on the time data\n+#\n+# \t\tvar now = new Time.now ==> Set the current time\n+# \t\tvar time = new Time(14,30,00) ==> (Hours, Minutes, Seconds)\n+class Time\n+\tsuper Comparable\n+\n+\t# Hours as an integer\n+\tvar hour: Int\n+\n+\t# Minutes as an integer\n+\tvar minute: Int\n+\n+\t# Seconds as an integer\n+\tvar second: Int\n+\n+\t# This will initialize the current time\n+\tinit now do\n+\t\tvar tm = new Tm.localtime\n+\t\thour = tm.hour\n+\t\tminute = tm.min\n+\t\tsecond = tm.sec\n+\tend\n+\n+\tredef fun ==(d)  \n+\tdo\n+\t\treturn d isa Time and time_eq(d)\n+\tend\n+\n+\t# This check if the time is eq or not\n+\tfun time_eq(d: Time): Bool\n+\tdo\n+\t\tif (hour * 3600 + minute * 60 + second) != (d.hour * 3600 + d.minute * 60 + d.second) then\n+\t\t\treturn false\n+\t\tend\n+\t\treturn true\n+\tend\n+end\n+\n+# The class \"DateTime\" allow the manipulation of date and time data\n+#\n+# \t\tvar today = new DateTime.today ==> set the current date and time\n+#\t\tvar date_time = DateTime(2014, 02, 09, 13, 50, 00) ==> (Year, Month, Day, Hours, Minutes, Seconds)\n+class DateTime\n+\tsuper Date\n+\tsuper Time\n+\tautoinit year, month, day, hour, minute, second\n+\n+\tredef init today do\n+\t\tsuper\n+\t\tvar tm = new Tm.localtime\n+\t\thour = tm.hour\n+\t\tminute = tm.min\n+\t\tsecond = tm.sec\n+\tend\n+\n+\tredef fun ==(d)  \n+\tdo\n+\t\treturn d isa DateTime and diff_days(d) == 0 and time_eq(d)\n+\tend\n+\n+\tredef fun to_s do\n+\t\treturn super + \" {hour.to_s}:{minute.to_s}:{second.to_s}{time_zone}\"\n+\tend\n+end\n+\n+# The class \"Date\" allow the manipulation only on the date data\n+#\n+#\t\tvar today = new Date ==> set the current date\n+#\t\tvar date = new Date(2014, 03, 04) ==> (Year, Month, Day)\n+class Date\n+\tsuper Comparable\n+\n+\t# Year as an integer ex: 1989\n+\tvar year: Int\n+\n+\t# Month as an integer ex: \"3\" for March\n+\tvar month: Int\n+\n+\t# Day as an integer \n+\tvar day: Int\n+\n+\t# UTC time zone\n+\tvar time_zone = \"Z\"\n+\n+\t# This will initialize the current date\n+\tinit today do\n+\t\tvar tm = new Tm.localtime\n+\t\tyear = 1900 + tm.year\n+\t\tmonth = tm.mon + 1\n+\t\tday = tm.mday\n+\tend\n+\n+\t# Date expressed according to ISO 8601\n+\tredef fun to_s \n+\tdo\n+\t\tvar y = year.to_s\n+\t\tvar mth = month.to_s\n+\t\tvar d = day.to_s\n+\n+\t\treturn \"{y}-{mth}-{d}\"\n+\tend\n+\t\n+\t# Compare two dates and return the difference in days\n+\tfun diff_days(other: Date): Int \n+\tdo\n+\t\tvar y_out  = 0\n+\t\tvar m_out  = 0\n+\n+\t\ty_out = year - other.year\n+\t\ty_out = y_out * 365\n+\t\tm_out = month - other.month\n+\t\tm_out = m_out * 30\n+\t\treturn day - other.day + m_out + y_out\n+\tend\n+\n+\t# Compare two dates and return the difference in months","path":"lib/date.nit","position":161,"original_position":161,"commit_id":"80954c7de22134bce905e5f2d1dc5a20c62be55a","original_commit_id":"80954c7de22134bce905e5f2d1dc5a20c62be55a","user":{"login":"Morriar","id":583144,"avatar_url":"https://avatars.githubusercontent.com/u/583144?v=3","gravatar_id":"","url":"https://api.github.com/users/Morriar","html_url":"https://github.com/Morriar","followers_url":"https://api.github.com/users/Morriar/followers","following_url":"https://api.github.com/users/Morriar/following{/other_user}","gists_url":"https://api.github.com/users/Morriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Morriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morriar/subscriptions","organizations_url":"https://api.github.com/users/Morriar/orgs","repos_url":"https://api.github.com/users/Morriar/repos","events_url":"https://api.github.com/users/Morriar/events{/privacy}","received_events_url":"https://api.github.com/users/Morriar/received_events","type":"User","site_admin":false},"body":"~~~nit\r\n# Returns the difference between two dates in months.\r\n~~~","created_at":"2015-05-20T19:25:42Z","updated_at":"2015-05-20T19:25:42Z","html_url":"https://github.com/privat/nit/pull/1100#discussion_r30739274","pull_request_url":"https://api.github.com/repos/privat/nit/pulls/1100","_links":{"self":{"href":"https://api.github.com/repos/privat/nit/pulls/comments/30739274"},"html":{"href":"https://github.com/privat/nit/pull/1100#discussion_r30739274"},"pull_request":{"href":"https://api.github.com/repos/privat/nit/pulls/1100"}}},"pull_request":{"url":"https://api.github.com/repos/privat/nit/pulls/1100","id":27279827,"html_url":"https://github.com/privat/nit/pull/1100","diff_url":"https://github.com/privat/nit/pull/1100.diff","patch_url":"https://github.com/privat/nit/pull/1100.patch","issue_url":"https://api.github.com/repos/privat/nit/issues/1100","number":1100,"state":"open","locked":false,"title":"Date Lib","user":{"login":"MehdiAit","id":3407293,"avatar_url":"https://avatars.githubusercontent.com/u/3407293?v=3","gravatar_id":"","url":"https://api.github.com/users/MehdiAit","html_url":"https://github.com/MehdiAit","followers_url":"https://api.github.com/users/MehdiAit/followers","following_url":"https://api.github.com/users/MehdiAit/following{/other_user}","gists_url":"https://api.github.com/users/MehdiAit/gists{/gist_id}","starred_url":"https://api.github.com/users/MehdiAit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MehdiAit/subscriptions","organizations_url":"https://api.github.com/users/MehdiAit/orgs","repos_url":"https://api.github.com/users/MehdiAit/repos","events_url":"https://api.github.com/users/MehdiAit/events{/privacy}","received_events_url":"https://api.github.com/users/MehdiAit/received_events","type":"User","site_admin":false},"body":"les fonctions ce trouve dans le module date_f.nit.","created_at":"2015-01-13T15:40:50Z","updated_at":"2015-05-20T19:25:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86c5a11b45c680a737c3a99cfad4536fa7fd75a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/privat/nit/pulls/1100/commits","review_comments_url":"https://api.github.com/repos/privat/nit/pulls/1100/comments","review_comment_url":"https://api.github.com/repos/privat/nit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/privat/nit/issues/1100/comments","statuses_url":"https://api.github.com/repos/privat/nit/statuses/80954c7de22134bce905e5f2d1dc5a20c62be55a","head":{"label":"MehdiAit:master","ref":"master","sha":"80954c7de22134bce905e5f2d1dc5a20c62be55a","user":{"login":"MehdiAit","id":3407293,"avatar_url":"https://avatars.githubusercontent.com/u/3407293?v=3","gravatar_id":"","url":"https://api.github.com/users/MehdiAit","html_url":"https://github.com/MehdiAit","followers_url":"https://api.github.com/users/MehdiAit/followers","following_url":"https://api.github.com/users/MehdiAit/following{/other_user}","gists_url":"https://api.github.com/users/MehdiAit/gists{/gist_id}","starred_url":"https://api.github.com/users/MehdiAit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MehdiAit/subscriptions","organizations_url":"https://api.github.com/users/MehdiAit/orgs","repos_url":"https://api.github.com/users/MehdiAit/repos","events_url":"https://api.github.com/users/MehdiAit/events{/privacy}","received_events_url":"https://api.github.com/users/MehdiAit/received_events","type":"User","site_admin":false},"repo":{"id":29065535,"name":"nit","full_name":"MehdiAit/nit","owner":{"login":"MehdiAit","id":3407293,"avatar_url":"https://avatars.githubusercontent.com/u/3407293?v=3","gravatar_id":"","url":"https://api.github.com/users/MehdiAit","html_url":"https://github.com/MehdiAit","followers_url":"https://api.github.com/users/MehdiAit/followers","following_url":"https://api.github.com/users/MehdiAit/following{/other_user}","gists_url":"https://api.github.com/users/MehdiAit/gists{/gist_id}","starred_url":"https://api.github.com/users/MehdiAit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MehdiAit/subscriptions","organizations_url":"https://api.github.com/users/MehdiAit/orgs","repos_url":"https://api.github.com/users/MehdiAit/repos","events_url":"https://api.github.com/users/MehdiAit/events{/privacy}","received_events_url":"https://api.github.com/users/MehdiAit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MehdiAit/nit","description":"Nit language","fork":true,"url":"https://api.github.com/repos/MehdiAit/nit","forks_url":"https://api.github.com/repos/MehdiAit/nit/forks","keys_url":"https://api.github.com/repos/MehdiAit/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MehdiAit/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MehdiAit/nit/teams","hooks_url":"https://api.github.com/repos/MehdiAit/nit/hooks","issue_events_url":"https://api.github.com/repos/MehdiAit/nit/issues/events{/number}","events_url":"https://api.github.com/repos/MehdiAit/nit/events","assignees_url":"https://api.github.com/repos/MehdiAit/nit/assignees{/user}","branches_url":"https://api.github.com/repos/MehdiAit/nit/branches{/branch}","tags_url":"https://api.github.com/repos/MehdiAit/nit/tags","blobs_url":"https://api.github.com/repos/MehdiAit/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MehdiAit/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MehdiAit/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/MehdiAit/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MehdiAit/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/MehdiAit/nit/languages","stargazers_url":"https://api.github.com/repos/MehdiAit/nit/stargazers","contributors_url":"https://api.github.com/repos/MehdiAit/nit/contributors","subscribers_url":"https://api.github.com/repos/MehdiAit/nit/subscribers","subscription_url":"https://api.github.com/repos/MehdiAit/nit/subscription","commits_url":"https://api.github.com/repos/MehdiAit/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/MehdiAit/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/MehdiAit/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/MehdiAit/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/MehdiAit/nit/contents/{+path}","compare_url":"https://api.github.com/repos/MehdiAit/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MehdiAit/nit/merges","archive_url":"https://api.github.com/repos/MehdiAit/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MehdiAit/nit/downloads","issues_url":"https://api.github.com/repos/MehdiAit/nit/issues{/number}","pulls_url":"https://api.github.com/repos/MehdiAit/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/MehdiAit/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/MehdiAit/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MehdiAit/nit/labels{/name}","releases_url":"https://api.github.com/repos/MehdiAit/nit/releases{/id}","created_at":"2015-01-10T17:51:56Z","updated_at":"2015-05-08T15:55:44Z","pushed_at":"2015-05-20T18:44:46Z","git_url":"git://github.com/MehdiAit/nit.git","ssh_url":"git@github.com:MehdiAit/nit.git","clone_url":"https://github.com/MehdiAit/nit.git","svn_url":"https://github.com/MehdiAit/nit","homepage":"http://nitlanguage.org","size":60763,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"privat:master","ref":"master","sha":"90bb4774df00a81b50a778696a0ba8de9c8c48c9","user":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"repo":{"id":328597,"name":"nit","full_name":"privat/nit","owner":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/privat/nit","description":"Nit language","fork":false,"url":"https://api.github.com/repos/privat/nit","forks_url":"https://api.github.com/repos/privat/nit/forks","keys_url":"https://api.github.com/repos/privat/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/privat/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/privat/nit/teams","hooks_url":"https://api.github.com/repos/privat/nit/hooks","issue_events_url":"https://api.github.com/repos/privat/nit/issues/events{/number}","events_url":"https://api.github.com/repos/privat/nit/events","assignees_url":"https://api.github.com/repos/privat/nit/assignees{/user}","branches_url":"https://api.github.com/repos/privat/nit/branches{/branch}","tags_url":"https://api.github.com/repos/privat/nit/tags","blobs_url":"https://api.github.com/repos/privat/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/privat/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/privat/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/privat/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/privat/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/privat/nit/languages","stargazers_url":"https://api.github.com/repos/privat/nit/stargazers","contributors_url":"https://api.github.com/repos/privat/nit/contributors","subscribers_url":"https://api.github.com/repos/privat/nit/subscribers","subscription_url":"https://api.github.com/repos/privat/nit/subscription","commits_url":"https://api.github.com/repos/privat/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/privat/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/privat/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/privat/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/privat/nit/contents/{+path}","compare_url":"https://api.github.com/repos/privat/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/privat/nit/merges","archive_url":"https://api.github.com/repos/privat/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/privat/nit/downloads","issues_url":"https://api.github.com/repos/privat/nit/issues{/number}","pulls_url":"https://api.github.com/repos/privat/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/privat/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/privat/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/privat/nit/labels{/name}","releases_url":"https://api.github.com/repos/privat/nit/releases{/id}","created_at":"2009-10-06T15:03:00Z","updated_at":"2015-05-20T15:54:30Z","pushed_at":"2015-05-20T18:55:53Z","git_url":"git://github.com/privat/nit.git","ssh_url":"git@github.com:privat/nit.git","clone_url":"https://github.com/privat/nit.git","svn_url":"https://github.com/privat/nit","homepage":"http://nitlanguage.org","size":85674,"stargazers_count":66,"watchers_count":66,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":115,"forks":40,"open_issues":115,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/privat/nit/pulls/1100"},"html":{"href":"https://github.com/privat/nit/pull/1100"},"issue":{"href":"https://api.github.com/repos/privat/nit/issues/1100"},"comments":{"href":"https://api.github.com/repos/privat/nit/issues/1100/comments"},"review_comments":{"href":"https://api.github.com/repos/privat/nit/pulls/1100/comments"},"review_comment":{"href":"https://api.github.com/repos/privat/nit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/privat/nit/pulls/1100/commits"},"statuses":{"href":"https://api.github.com/repos/privat/nit/statuses/80954c7de22134bce905e5f2d1dc5a20c62be55a"}}}}