You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3851 Reporter: administrator Status: acknowledged Resolution: open Priority: normal Severity: feature Category: otherlibs Tags: patch Child of:#3849 Monitored by:@rixed smithjoshuab
Bug description
Full_Name: Joshua Smith
Version: 3.09
OS: Linux
Submission from: dsl092-167-152.wdc2.dsl.speakeasy.net (66.92.167.152)
Here is a patch that adds these:
Index: otherlibs/unix/unix.mli
--- otherlibs/unix/unix.mli (revision 1)
+++ otherlibs/unix/unix.mli (revision 5)
@@ -733,15 +733,30 @@
(** Convert a time in seconds, as returned by {!Unix.time}, into a date and
a time. Assumes the local time zone. *)
+val strptime: string -> string -> tm
(** This function is the converse of the {!Unix.strftime} function.
[strptime fmt data] convert a string containing time information [data]
into a [tm] struct according to the format specified by [fmt]. *)
+val asctime: tm -> string
(** Return the ascii representation of a given [tm] argument. The
ascii time is returned in the form of a string like
'Wed Jun 30, 21:21:21 2005\n' *)
+val strftime: string -> tm -> string
(** This functions is the converse of the {!Unix.strptime} function.
[strftime fmt data] convert a a [tm] structure [data] into a string
according to the format specified by [fmt]. *)
val mktime : tm -> float * tm
-(** Convert a date and time, specified by the [tm] argument, into
a time in seconds, as returned by {!Unix.time}. The [tm_isdst],
[tm_wday] and [tm_yday] fields of [tm] are ignored. Also return a
normalized copy of the given [tm] record, with the [tm_wday],
[tm_yday], and [tm_isdst] fields recomputed from the other fields,
and the other fields normalized (so that, e.g., 40 October is
changed into 9 November). The [tm] argument is interpreted in the
local time zone. *)
(** Convert a date and time, specified by the [tm] argument, into
a time in seconds, as returned by {!Unix.time}. The [tm_isdst],
[tm_wday] and [tm_yday] fields of [tm] are ignored. Also return a
normalized copy of the given [tm] record, with the [tm_wday],
[tm_yday], and [tm_isdst] fields recomputed from the other fields,
and the other fields normalized (so that, e.g., 40 October is
changed into 9 November). The [tm] argument is interpreted in the
local time zone. *)
val alarm : int -> int
(** Schedule a [SIGALRM] signal after the given number of seconds. *)
Index: otherlibs/unix/gmtime.c
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Original bug ID: 3851
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: otherlibs
Tags: patch
Child of: #3849
Monitored by: @rixed smithjoshuab
Bug description
Full_Name: Joshua Smith
Version: 3.09
OS: Linux
Submission from: dsl092-167-152.wdc2.dsl.speakeasy.net (66.92.167.152)
Here is a patch that adds these:
Index: otherlibs/unix/unix.mli
--- otherlibs/unix/unix.mli (revision 1)
+++ otherlibs/unix/unix.mli (revision 5)
@@ -733,15 +733,30 @@
(** Convert a time in seconds, as returned by {!Unix.time}, into a date and
a time. Assumes the local time zone. *)
+val strptime: string -> string -> tm
+val asctime: tm -> string
+val strftime: string -> tm -> string
val mktime : tm -> float * tm
-(** Convert a date and time, specified by the [tm] argument, into
val alarm : int -> int
(** Schedule a [SIGALRM] signal after the given number of seconds. *)
Index: otherlibs/unix/gmtime.c
--- otherlibs/unix/gmtime.c (revision 1)
+++ otherlibs/unix/gmtime.c (revision 5)
@@ -13,6 +13,7 @@
/* $Id: gmtime.c,v 1.17 2005/03/24 17:20:53 doligez Exp $ */
+#define _XOPEN_SOURCE
#include <mlvalues.h>
#include <alloc.h>
#include <fail.h>
@@ -20,7 +21,6 @@
#include "unixsupport.h"
#include <time.h>
#include <errno.h>
static value alloc_tm(struct tm *tm)
{
value res;
@@ -59,6 +59,56 @@
#ifdef HAS_MKTIME
+CAMLprim value unix_strptime(value f,value d) {
+
+}
+CAMLprim value unix_asctime(value t) {
+}
+
+CAMLprim value unix_strftime(value f,value t) {
+
+}
+
CAMLprim value unix_mktime(value t)
{
struct tm tm;
@@ -89,6 +139,15 @@
#else
+CAMLprim value unix_strptime(value f,value d)
+{ invalid_argument("strptime not implemented"); }
+
+CAMLprim value unix_asctime(value t) {
+{ invalid_argument("asctime not implemented"); }
+
+CAMLprim value unix_strftime(value f,value t) {
+{ invalid_argument("strftime not implemented"); }
+
CAMLprim value unix_mktime(value t)
{ invalid_argument("mktime not implemented"); }
Index: otherlibs/unix/unix.ml
--- otherlibs/unix/unix.ml (revision 1)
+++ otherlibs/unix/unix.ml (revision 5)
@@ -337,6 +337,9 @@
external gettimeofday : unit -> float = "unix_gettimeofday"
external gmtime : float -> tm = "unix_gmtime"
external localtime : float -> tm = "unix_localtime"
+external strptime : string -> string -> tm = "unix_strptime"
+external asctime : tm -> string = "unix_asctime"
+external strftime : string -> tm -> string = "unix_strftime"
external mktime : tm -> float * tm = "unix_mktime"
external alarm : int -> int = "unix_alarm"
external sleep : int -> unit = "unix_sleep"
Index: otherlibs/threads/unix.ml
--- otherlibs/threads/unix.ml (revision 1)
+++ otherlibs/threads/unix.ml (revision 5)
@@ -457,6 +457,9 @@
external gettimeofday : unit -> float = "unix_gettimeofday"
external gmtime : float -> tm = "unix_gmtime"
external localtime : float -> tm = "unix_localtime"
+external strptime : string -> string -> tm = "unix_strptime"
+external asctime : tm -> string = "unix_asctime"
+external strftime : string -> tm -> string = "unix_strftime"
external mktime : tm -> float * tm = "unix_mktime"
external alarm : int -> int = "unix_alarm"
The text was updated successfully, but these errors were encountered: