source: to-imperative/trunk/library/Dos/time.cc @ 1077

Last change on this file since 1077 was 1077, checked in by luba, 18 years ago
  • string format is corrected
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 670 bytes
Line 
1// $Source$
2// $Revision: 1077 $
3// $Date: 2003-07-30 20:48:08 +0000 (Wed, 30 Jul 2003) $
4// $Author: luba $
5
6#include <rf_core.hh>
7#include <stdlib.h>
8#include <time.h>
9#include <sys/time.h>
10#include <locale.h>
11#include <langinfo.h>
12
13namespace refal
14{
15using namespace rfrt;
16using namespace rftype;
17
18namespace Dos
19{
20
21RF_FUNC (Time, (), (RF_RES e_String))
22 
23  struct timeval ttt;
24  struct tm* lt; 
25  unsigned uu;
26
27  setlocale(LC_TIME, "");
28
29  gettimeofday(&ttt,NULL); 
30  lt = localtime (&(ttt.tv_sec)); 
31  uu = ttt.tv_usec/10000; 
32
33  char s[256]; 
34  strftime(s, sizeof(s), "%d %b %G %H:%M:%S", lt);
35
36  e_String = Char::create_expr(s) +
37             Char::create_expr(".")+
38             ShortInt::create_expr(uu) ;
39
40RF_END
41
42}
43 
44}
45
46
Note: See TracBrowser for help on using the repository browser.