project_files/hwc/rtl/sysutils.c
changeset 14913 68e1783762bc
parent 10564 0cb20aa8877a
child 15877 6cb7330113d8
equal deleted inserted replaced
14912:3a53309e684b 14913:68e1783762bc
    78 TDateTime fpcrtl_now()
    78 TDateTime fpcrtl_now()
    79 {
    79 {
    80     return fpcrtl_date() + fpcrtl_time();
    80     return fpcrtl_date() + fpcrtl_time();
    81 }
    81 }
    82 
    82 
    83 /*
    83 // Semi-dummy implementation of FormatDateTime
    84  * XXX: dummy
       
    85  */
       
    86 string255 fpcrtl_formatDateTime(string255 FormatStr, TDateTime DateTime)
    84 string255 fpcrtl_formatDateTime(string255 FormatStr, TDateTime DateTime)
    87 {
    85 {
    88     string255 result = STRINIT("2012 01-01");
    86     string255 buffer = STRINIT(FormatStr.str);
    89     return result;
    87     time_t rawtime;
       
    88     struct tm* my_tm;
       
    89 
       
    90     // DateTime is ignored, always uses current time.
       
    91     // TODO: Use DateTime argument properly.
       
    92     time(&rawtime);
       
    93     my_tm = localtime(&rawtime);
       
    94 
       
    95     // Currently uses a hardcoded format string, FormatStr is ignored.
       
    96     // The format strings for C and Pascal differ!
       
    97     // TODO: Use FormatStr argument properly.
       
    98     size_t len = strftime(buffer.str, sizeof(buffer.str), "%Y-%m-%d-%H-%M-%S-0", my_tm);
       
    99     buffer.len = len;
       
   100     return buffer;
    90 }
   101 }
    91 
   102 
    92 string255 fpcrtl_trim(string255 s)
   103 string255 fpcrtl_trim(string255 s)
    93 {
   104 {
    94     int left, right;
   105     int left, right;