Skip to content

Commit

Permalink
More reasonable definitions for LocalTZA and DaylightSavingsTA; can s…
Browse files Browse the repository at this point in the history
…till do better. Also a bug fix for 'now'

--HG--
branch : com.mozilla.es4.smlnj
extra : convert_revision : 7299a2851e812b3343696896d03ab6e6c949a5d1
  • Loading branch information
[email protected] committed Apr 26, 2007
1 parent 626aa33 commit d34fd04
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions native.sml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ fun getClassName (vals:Mach.VAL list)
| SOME (Mach.Int _) => "Number"
| SOME (Mach.UInt _) => "Number"
| SOME (Mach.Double _) => "Number"
| _ => "Object"
| _ =>
(* FIXME: "Array", "RegExp", "String", ... The object needs
* to carry a reference to its class, but it doesn't.
*)
"Object"
in
Eval.newString str
end
Expand Down Expand Up @@ -597,7 +601,7 @@ fun set (vals:Mach.VAL list)

fun now (vals:Mach.VAL list)
: Mach.VAL =
Eval.newDouble ((Time.toReal (Time.now())) * 1000.0)
Eval.newDouble (Real.realFloor ((Time.toReal (Time.now())) * 1000.0))

(*
Math natives
Expand Down Expand Up @@ -892,8 +896,8 @@ fun registerNatives _ =

(* FIXME: stubs to get Date loading. Implement. *)
addFn Name.intrinsicNS "now" now;
addFn Name.publicNS "LocalTZA" (fn _ => Eval.newDouble 1.0);
addFn Name.publicNS "DaylightSavingsTA" (fn _ => Eval.newDouble 1.0);
addFn Name.publicNS "LocalTZA" (fn _ => Eval.newDouble 0.0);
addFn Name.publicNS "DaylightSavingsTA" (fn _ => Eval.newDouble 0.0);

(* Math.es natives *)
addFn Name.intrinsicNS "abs" abs;
Expand Down

0 comments on commit d34fd04

Please sign in to comment.