| Anonymous | Login | Signup for a new account | 2013-06-20 08:28 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0005063 | OCaml | OCaml general | public | 2010-05-28 18:47 | 2011-06-01 23:01 | ||||||
| Reporter | dario | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | N/A | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.11.2 | ||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0005063: Unix module does not offer access to tzname | ||||||||||
| Description | The "Time Functions" in the Unix module provide comprehensive coverage of the time-related operations available in Libc. There is one conspicuous absence, however: the tzname variable, which provides access to the DST-adjusted abbreviated name of the current timezone. Presently, accessing this value from an Ocaml program requires writing a small C function. | ||||||||||
| Additional Information | The function 'sprint_timestamp' listed below returns a string with the given timestamp pretty-printed in a complete form, ie, including also the abbreviated timezone name adjusted for daylight-savings. It must be written in C, since the Unix module offers no access to the tzname variable. CAMLprim value sprint_timestamp (value v_time) { CAMLparam1 (v_time); CAMLlocal1 (v_res); time_t time = Double_val (v_time); struct tm* lt = localtime (&time); char res [40]; snprintf (res, sizeof (res), "%04d-%02d-%02d %02d:%02d:%02d (%s)", (lt->tm_year) + 1900, (lt->tm_mon) + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, tzname [lt->tm_isdst]); v_res = caml_copy_string (res); CAMLreturn (v_res); } | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2010-05-28 18:47 | dario | New Issue | |
| 2011-06-01 23:01 | doligez | Status | new => acknowledged |
| Copyright © 2000 - 2011 MantisBT Group |