Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
79d43af7
Commit
79d43af7
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Added logog logging in file DateTools.cpp.
parent
a37a9e4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
BaseLib/DateTools.cpp
+18
-16
18 additions, 16 deletions
BaseLib/DateTools.cpp
with
18 additions
and
16 deletions
BaseLib/DateTools.cpp
+
18
−
16
View file @
79d43af7
...
...
@@ -12,18 +12,22 @@
*
*/
#include
"DateTools.h"
#include
<cmath>
#include
<cstdlib>
#include
<iostream>
namespace
BaseLib
{
// ThirdParty/logog
#include
"logog/include/logog.hpp"
#include
"DateTools.h"
namespace
BaseLib
{
int
date2int
(
int
y
,
int
m
,
int
d
)
{
if
(
(
y
<
1000
||
y
>
9999
)
||
(
m
<
1
||
m
>
12
)
||
(
d
<
1
||
d
>
31
)
)
{
std
::
cout
<<
"Error:
date2double()
-- i
nput not in expected
format."
<<
std
::
endl
;
WARN
(
"
date2double()
: I
nput not in expected
range."
)
;
return
0
;
}
...
...
@@ -37,16 +41,16 @@ int date2int(int y, int m, int d)
std
::
string
int2date
(
int
date
)
{
if
(
date
>
10000000
&&
date
<
22000000
)
if
(
date
>
10000000
&&
date
<
22000000
)
{
int
y
=
static_cast
<
int
>
(
floor
(
date
/
10000.0
));
int
m
=
static_cast
<
int
>
(
floor
((
date
-
(
y
*
10000
))
/
100.0
));
int
d
=
date
-
(
y
*
10000
)
-
(
m
*
100
);
int
y
=
static_cast
<
int
>
(
floor
(
date
/
10000.0
));
int
m
=
static_cast
<
int
>
(
floor
((
date
-
(
y
*
10000
))
/
100.0
));
int
d
=
date
-
(
y
*
10000
)
-
(
m
*
100
);
std
::
stringstream
ss
;
if
(
d
<
10
)
if
(
d
<
10
)
ss
<<
"0"
;
ss
<<
d
<<
"."
;
if
(
m
<
10
)
if
(
m
<
10
)
ss
<<
"0"
;
ss
<<
m
<<
"."
<<
y
;
return
ss
.
str
();
...
...
@@ -58,7 +62,7 @@ std::string date2string(double ddate)
{
if
(
ddate
<
10000101
||
ddate
>
99991231
)
{
std
::
cout
<<
"Error:
date2String()
-- i
nput not in expected format."
<<
std
::
endl
;
WARN
(
"
date2String()
: I
nput not in expected format."
)
;
return
"0.0.0000"
;
}
...
...
@@ -67,11 +71,11 @@ std::string date2string(double ddate)
rest
=
rest
%
(
y
*
10000
);
int
m
=
static_cast
<
int
>
(
floor
(
rest
/
100.0
));
if
(
m
<
1
||
m
>
12
)
std
::
cout
<<
"Warning:
date2String()
--
month not in [1:12]
"
<<
std
::
endl
;
WARN
(
"
date2String()
:
month not in [1:12]
."
)
;
rest
=
rest
%
(
m
*
100
);
int
d
=
rest
;
if
(
d
<
1
||
d
>
31
)
std
::
cout
<<
"Warning:
date2String()
--
day not in [1:31]
"
<<
std
::
endl
;
WARN
(
"
date2String()
:
day not in [1:31]
."
)
;
std
::
string
day
=
BaseLib
::
number2str
(
d
);
if
(
d
<
10
)
...
...
@@ -102,15 +106,13 @@ int xmlDate2int(const std::string &s)
{
int
d
=
atoi
(
s
.
substr
(
8
,
2
).
c_str
());
if
(
d
<
1
||
d
>
31
)
std
::
cout
<<
"Warning:
xmlDate2double()
--
day not in [1:31]
"
<<
std
::
endl
;
WARN
(
"
xmlDate2double()
:
day not in [1:31]
."
)
;
int
m
=
atoi
(
s
.
substr
(
5
,
2
).
c_str
());
if
(
m
<
1
||
m
>
12
)
std
::
cout
<<
"Warning: xmlDate2double() -- month not in [1:12]"
<<
std
::
endl
;
WARN
(
"xmlDate2double(): month not in [1:12]."
);
int
y
=
atoi
(
s
.
substr
(
0
,
4
).
c_str
());
return
date2int
(
y
,
m
,
d
);
}
return
0
;
}
}
// end namespace BaseLib
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment