Skip to content

Instantly share code, notes, and snippets.

Created February 6, 2012 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1752783 to your computer and use it in GitHub Desktop.
Save anonymous/1752783 to your computer and use it in GitHub Desktop.
diff --git a/opabsl/jsbsl/bslTime.js b/opabsl/jsbsl/bslTime.js
index c7cee7d..207ef7a 100644
--- a/opabsl/jsbsl/bslTime.js
+++ b/opabsl/jsbsl/bslTime.js
@@ -159,10 +159,10 @@ function now()
return t.getHours();
}
-##register local_timezone_offset : time_t -> int
- ##args(f)
+##register local_timezone_offset : -> int
+ ##args()
{
- var t = new Date(); t.setTime(f)
+ var t = new Date();
return t.getTimezoneOffset();
}
diff --git a/opabsl/mlbsl/bslTime.ml b/opabsl/mlbsl/bslTime.ml
index afb740b..cba3b96 100644
--- a/opabsl/mlbsl/bslTime.ml
+++ b/opabsl/mlbsl/bslTime.ml
@@ -83,7 +83,7 @@
##register local_hour : time_t -> int
let local_hour t = Time.local_hour (wrap t)
- ##register local_timezone_offset : time_t -> int
+ ##register local_timezone_offset : -> int
let local_timezone_offset _ = Time.local_timezone_offset()
##register local_mday : time_t -> int
diff --git a/stdlib/core/date/date.opa b/stdlib/core/date/date.opa
index 7c5a021..492e0d0 100644
--- a/stdlib/core/date/date.opa
+++ b/stdlib/core/date/date.opa
@@ -432,8 +432,7 @@ type time_t = external
* @return The local timezone (+hhmm or -hhmm).
**/
get_local_timezone : -> string = -> (
- t : Date.date = Date.now()
- delta : int = Date_private.time_local_timezone_offset(t)
+ delta : int = Date_private.time_local_timezone_offset()
// delta is the timezone in minutes, so we need to convert it into
// +hhmm or -hhmm. If delta is positive, the timezone is -hhmm. Otherwise
// the timezone is +hhmm.
diff --git a/stdlib/core/date/date_private.opa b/stdlib/core/date/date_private.opa
index 05fc865..f390aae 100644
--- a/stdlib/core/date/date_private.opa
+++ b/stdlib/core/date/date_private.opa
@@ -105,8 +105,8 @@ import stdlib.core.parser
time_local_hour : Date.date -> int =
date_in(%%BslTime.local_hour%% : time_t -> int) // Hours 0..23
- time_local_timezone_offset : Date.date -> int =
- date_in(%%BslTime.local_timezone_offset%% : time_t -> int)
+ time_local_timezone_offset : -> int =
+ %%BslTime.local_timezone_offset%% : -> int
time_local_mday : Date.date -> int =
date_in(%%BslTime.local_mday%% : time_t -> int) // Day of month 1..31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment