Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
a557a8ee
Commit
a557a8ee
authored
Oct 04, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved clock_gettime() for MacOS to co_time.
parent
118aff70
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
219 deletions
+30
-219
src/lib/co/src/co_time.c
src/lib/co/src/co_time.c
+30
-0
src/lib/co/src/os_freebsd/co_clock.c
src/lib/co/src/os_freebsd/co_clock.c
+0
-73
src/lib/co/src/os_macos/co_clock.c
src/lib/co/src/os_macos/co_clock.c
+0
-73
src/lib/co/src/os_openbsd/co_clock.c
src/lib/co/src/os_openbsd/co_clock.c
+0
-73
No files found.
src/lib/co/src/co_time.c
View file @
a557a8ee
...
...
@@ -39,6 +39,9 @@
localtime_r must be used, which doesn't exist on DEC. */
#include <ctype.h>
#ifdef OS_MACOS
#include <errno.h>
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -73,6 +76,33 @@
static
const
char
*
monStr
[]
=
{
"JAN"
,
"FEB"
,
"MAR"
,
"APR"
,
"MAY"
,
"JUN"
,
"JUL"
,
"AUG"
,
"SEP"
,
"OCT"
,
"NOV"
,
"DEC"
};
#ifdef OS_MACOS
int
clock_gettime
(
clockid_t
clockid
,
struct
timespec
*
pt
)
{
if
(
clockid
==
CLOCK_REALTIME
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
if
(
clockid
==
CLOCK_MONOTONIC
)
{
// TODO
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
}
#endif
static
pwr_tStatus
validateTm
(
struct
tm
*
tms
);
/* Validate data in struct tm. */
...
...
src/lib/co/src/os_freebsd/co_clock.c
deleted
100644 → 0
View file @
118aff70
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* co_clock.c -- .
*/
#ifndef OS_FREEBSD
#error This file is only for FreeBSD
#endif
#include <errno.h>
#include "co_time.h"
#include "co_time_msg.h"
int
clock_gettime
(
clockid_t
clockid
,
struct
timespec
*
pt
)
{
if
(
clockid
==
CLOCK_REALTIME
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
if
(
clockid
==
CLOCK_MONOTONIC
)
{
// TODO
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
}
src/lib/co/src/os_macos/co_clock.c
deleted
100644 → 0
View file @
118aff70
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* co_clock.c -- .
*/
#ifndef OS_MACOS
#error This file is only for Mac OS
#endif
#include <errno.h>
#include "co_time.h"
#include "co_time_msg.h"
int
clock_gettime
(
clockid_t
clockid
,
struct
timespec
*
pt
)
{
if
(
clockid
==
CLOCK_REALTIME
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
if
(
clockid
==
CLOCK_MONOTONIC
)
{
// TODO
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
}
src/lib/co/src/os_openbsd/co_clock.c
deleted
100644 → 0
View file @
118aff70
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* co_clock.c -- .
*/
#ifndef OS_OPENBSD
#error This file is only for OpenBSD
#endif
#include <errno.h>
#include "co_time.h"
#include "co_time_msg.h"
int
clock_gettime
(
clockid_t
clockid
,
struct
timespec
*
pt
)
{
if
(
clockid
==
CLOCK_REALTIME
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
if
(
clockid
==
CLOCK_MONOTONIC
)
{
// TODO
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
pt
->
tv_sec
=
tv
.
tv_sec
;
pt
->
tv_nsec
=
tv
.
tv_usec
*
1000
;
}
else
{
errno
=
EINVAL
;
return
-
1
;
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment