source: git/ntl/src/tools.c @ 2cfffe

spielwiese
Last change on this file since 2cfffe was 2cfffe, checked in by Hans Schönemann <hannes@…>, 21 years ago
This commit was generated by cvs2svn to compensate for changes in r6316, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6317 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 709 bytes
Line 
1
2#include <NTL/tools.h>
3
4#include <NTL/new.h>
5
6NTL_START_IMPL
7
8
9void Error(const char *s)
10{
11   cerr << s << "\n";
12   abort();
13}
14
15long SkipWhiteSpace(istream& s)
16{
17   long c;
18
19   c = s.peek();
20   while (c == ' ' || c == '\n' || c == '\t') {
21      s.get();
22      c = s.peek();
23   }
24
25   if (c == EOF)
26      return 0;
27   else
28      return 1;
29}
30
31
32void PrintTime(ostream& s, double t)
33{
34   long hh, mm, ss;
35
36   ss = long(t + 0.5);
37
38   hh = ss/3600;
39   ss = ss - hh*3600;
40   mm = ss/60;
41   ss = ss - mm*60;
42
43   if (hh > 0)
44      s << hh << ":";
45
46   if (hh > 0 || mm > 0) {
47      if (hh > 0 && mm < 10) s << "0";
48      s << mm << ":";
49   }
50
51   if ((hh > 0 || mm > 0) && ss < 10) s << "0";
52   s << ss;
53}
54
55NTL_END_IMPL
Note: See TracBrowser for help on using the repository browser.