# Differences

This shows you the differences between two versions of the page.

thomaslocke [Thanks]
thomaslocke [A Full Program]
Line 1: Line 1:
=====  Introduction ​ ===== =====  Introduction ​ =====

=====  Caveat ​ ===== =====  Caveat ​ =====

-The following ​is an example ​of how to do something. It's not meant to be used in any real capacity. If you need a portable [[http://​adaic.org/​standards/​05rm/​html/​RM-3-6-3.html#​I1889|String]] representation of [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6.html#​I3747|Ada.Calendar.Clock]],​ then you're better off using the many nice features of [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6-1.html#​I3773|Ada.Calendar.Formatting]].+The following ​are examples ​of how to do something. It's not meant to be used in any real capacity. If you need a portable [[http://​adaic.org/​standards/​05rm/​html/​RM-3-6-3.html#​I1889|String]] representation of [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6.html#​I3747|Ada.Calendar.Clock]],​ then you're better off using the many nice features of [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6-1.html#​I3773|Ada.Calendar.Formatting]].

=====  The Problem ​ ===== =====  The Problem ​ =====
Line 18: Line 18:
===== One Solution ===== ===== One Solution =====

-For my experiment I've used the [[http://​libre.adacore.com/​libre/​|GNAT GPL 2010]] compiler, and in this compiler the [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6.html#​I3747|Time]] type is declared as:+In this first solution, we're going to make use of the //'​Address//​ attribute. ​For my experiment I've used the [[http://​libre.adacore.com/​libre/​|GNAT GPL 2010]] compiler, and in this compiler the [[http://​adaic.org/​standards/​05rm/​html/​RM-9-6.html#​I3747|Time]] type is declared as:

Line 81: Line 81:
===== Another Solution ===== ===== Another Solution =====

Line 106: Line 106:
warning: representation of Time values may change between GNAT versions   warning: representation of Time values may change between GNAT versions
​   ​
-You're not going to get that with the first method, and in my humble opinion that warning alone makes it worthwhile to use //​Ada.Unchecked_Conversion//​. +You're not going to get that with the first method, and in my humble opinion that warning alone makes it worthwhile to use //​Ada.Unchecked_Conversion// ​instead of the //'​Address//​ attribute used in the first solution
-===== Full Program =====+===== The Full Program =====

Lets end with a little program that utilizes both solutions to output the value of //​Ada.Calendar.Clock//:​ Lets end with a little program that utilizes both solutions to output the value of //​Ada.Calendar.Clock//:​
Line 120: Line 120:
+
+   ​----------------------
+   ​-- ​ Time_Image_One ​ --
+   ​----------------------

​function Time_Image_One    ​function Time_Image_One
Line 134: Line 138: