Changeset f9bb68 in git for kernel/timer.cc


Ignore:
Timestamp:
Aug 27, 2010, 10:15:09 AM (14 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
555b030713519677d5c1d72e1cdfacc419cc4bdc
Parents:
5cb9ecd7f9c68100731d2b46abd492589627c598
Message:
implemented and documented new command 'datetime' for local date/time as string

git-svn-id: file:///usr/local/Singular/svn/trunk@13152 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/timer.cc

    r5cb9ec rf9bb68  
    176176extern int iiOp;
    177177#endif
     178
     179char* dateTime()
     180{
     181#ifdef GETRUSAGE
     182  time_t rawtime;
     183  time(&rawtime);
     184  char* s = ctime(&rawtime);     // s: with linefeed at the end
     185  int l = strlen(s);
     186  char* ss = (char*)omAlloc(l);
     187  strncpy(ss, s, l - 1);
     188  ss[l - 1] = '\0';              // ss: without linefeed at the end
     189  return ss;
     190#else
     191  char* s = "Warning: date/time not available on your system";
     192  int l = strlen(s) + 1;
     193  char* ss = (char*)omAlloc(l);
     194  strncpy(ss, s, l - 1);
     195  ss[l - 1] = '\0';
     196  return ss;
     197#endif
     198}
     199
    178200void writeTime(const char* v)
    179201{
Note: See TracChangeset for help on using the changeset viewer.