[m-rev.] diff: gmtime_to_timestamp_2

Peter Ross pro at missioncriticalit.com
Tue Nov 4 05:15:29 AEDT 2003


Hi,


===================================================================


Estimated hours taken: 2
Branches: main

compiler/timestamp.m:
	Implementation of gmtime_to_timestamp_2 in C#.


Index: compiler/timestamp.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/timestamp.m,v
retrieving revision 1.7
diff -u -r1.7 timestamp.m
--- compiler/timestamp.m	21 Nov 2002 07:08:40 -0000	1.7
+++ compiler/timestamp.m	3 Nov 2003 18:12:44 -0000
@@ -102,12 +102,16 @@
 	strftime(Result, size, ""%Y-%m-%d %H:%M:%S"", &t);
 }").
 
-:- pragma foreign_proc("MC++",
-	gmtime_to_timestamp_2(_Yr::in, _Mnt::in, _MD::in, _Hrs::in, _Min::in,
-		_Sec::in, _YD::in, _WD::in, _N::in) = (_Result::out),
+:- pragma foreign_proc("C#",
+	gmtime_to_timestamp_2(Yr::in, Mnt::in, MD::in, Hrs::in, Min::in,
+		Sec::in, _YD::in, _WD::in, _N::in) = (Result::out),
 	[will_not_call_mercury, promise_pure],
 "{
-	mercury::runtime::Errors::SORRY(""foreign code for this function"");
+	System.DateTime t;
+	t = new System.DateTime(Yr + 1900, Mnt + 1, MD, Hrs, Min, Sec);
+
+	string format_str = ""yyyy-MM-dd hh:mm:ss"";
+	Result = t.ToString(format_str);
 }").
 
 :- func maybe_dst_to_int(maybe(dst)) = int.


-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list