aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorPascal Obry <obry@adacore.com>2014-07-18 09:31:36 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-18 11:31:36 +0200
commitc3d01e19a33b26764c40d67e6f3f86efbd86b203 (patch)
tree3cf048a2785ddc3db22b53a2e4094c9d31181a00 /gcc/ada/adaint.c
parent6907542db49aa9d73dcfe4a991bac455b1818953 (diff)
downloadgcc-c3d01e19a33b26764c40d67e6f3f86efbd86b203.zip
gcc-c3d01e19a33b26764c40d67e6f3f86efbd86b203.tar.gz
gcc-c3d01e19a33b26764c40d67e6f3f86efbd86b203.tar.bz2
s-os_lib.ads, [...] (GM_Time_Of): New routine to create an OS_Time from time parts.
2014-07-18 Pascal Obry <obry@adacore.com> * s-os_lib.ads, s-os_lib.adb (GM_Time_Of): New routine to create an OS_Time from time parts. * adaint.h, adaint.c (__gnat_to_os_time): New routine. From-SVN: r212788
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 607ba82..6e0e4a3d 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -503,6 +503,25 @@ __gnat_to_gm_time (OS_Time *p_time, int *p_year, int *p_month, int *p_day,
*p_year = *p_month = *p_day = *p_hours = *p_mins = *p_secs = 0;
}
+void
+__gnat_to_os_time (OS_Time *p_time, int year, int month, int day,
+ int hours, int mins, int secs)
+{
+ struct tm v;
+
+ v.tm_year = year;
+ v.tm_mon = month;
+ v.tm_mday = day;
+ v.tm_hour = hours;
+ v.tm_min = mins;
+ v.tm_sec = secs;
+ v.tm_isdst = 0;
+
+ /* returns -1 of failing, this is s-os_lib Invalid_Time */
+
+ *p_time = (OS_Time) mktime (&v);
+}
+
/* Place the contents of the symbolic link named PATH in the buffer BUF,
which has size BUFSIZ. If PATH is a symbolic link, then return the number
of characters of its content in BUF. Otherwise, return -1.