// This file is part of the Herezh++ application.
//
// The finite element software Herezh++ is dedicated to the field
// of mechanics for large transformations of solid structures.
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
//
// Herezh++ is distributed under GPL 3 license ou ultérieure.
//
// Copyright (C) 1997-2021 Université Bretagne Sud (France)
// AUTHOR : Gérard Rio
// E-MAIL  : gerardrio56@free.fr
//
// 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 3 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 this program. If not, see <https://www.gnu.org/licenses/>.
//
// For more information, please consult: <https://herezh.irdl.fr/>.

 /************************************************************************
 *     DATE:        01/02/2016                                          *
 *                                                                $     *
 *     AUTEUR:      G RIO   (mailto:gerardrio56@free.fr)                *
 *                                                                $     *
 *     PROJET:      Herezh++                                            *
 *                                                                $     *
 ************************************************************************
 *     BUT:  une classe dédiée à la gestion des temps d'exécution.      *
 *     Il s'agit ici de la modification et de l'adaptation du fichier   *
 *     boost/chrono/process_cpu_clocks.hpp de la bibliothèque boost     *
 *     pour utiliser un chrono en microseconde plutôt que nano.         *
 *** en fait pas utilisé !!!!!!!!!!!
 *                                                                $     *
 *     ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     *              *                                                                $     *
 ************************************************************************/
#ifndef CHRONO_GR_H
#define CHRONO_GR_H

/** @defgroup chrono_boost_modifié_GR chrono_boost_modifié_par_GR
*
*     BUT:  une classe dédiée à la gestion des temps d'exécution.
*     Il s'agit ici de la modification et de l'adaptation du fichier
*     boost/chrono/process_cpu_clocks.hpp de la bibliothèque boost
*     pour utiliser un chrono en microseconde plutôt que nano.
*
*
* \author    Gérard Rio
* \version   1.0
* \date      01/02/2016
* \brief     boost/chrono/process_cpu_clocks.hpp pour utiliser un chrono en microseconde plutôt que nano.
*
*/

//  modification et adaptation du fichier si dessous pour utiliser un chrono en microseconde plutôt quane nano

//  boost/chrono/process_cpu_clocks.hpp  -----------------------------------------------------------//

//  Copyright 2009-2011 Vicente J. Botet Escriba
//  Copyright (c) Microsoft Corporation 2014

//  Distributed under the Boost Software License, Version 1.0.
//  See http://www.boost.org/LICENSE_1_0.txt

//  See http://www.boost.org/libs/system for documentation.


#include <boost/chrono/config.hpp>


#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)

#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/operators.hpp>
#include <boost/chrono/detail/system.hpp>
#include <iostream>
#include <boost/type_traits/common_type.hpp>
#include <boost/chrono/clock_string.hpp>

#ifndef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_prefix.hpp> // must be the last #include
#endif

/// @addtogroup chrono_boost_modifié_GR
///  @{

/// GR : ajout dans le namespace boost
namespace boost
 {
/// GR : ajout dans le namespace chrono
  namespace chrono
  {

    class BOOST_CHRONO_DECL process_real_cpu_clock_micro_GR  ///< ajout de _micro_GR
    {
      public:
        typedef microseconds                         duration; ///< ici on a changé nano en micro
        typedef duration::rep                        rep;
        typedef duration::period                     period;
        typedef chrono::time_point<process_real_cpu_clock_micro_GR>    time_point; ///< ici ajout de _micro_GR
        BOOST_STATIC_CONSTEXPR bool is_steady =             true;

        static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
        static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
    };
   
   
   
   
   

#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
    class BOOST_CHRONO_DECL process_user_cpu_clock_micro_GR ///< ajout de _micro_GR
    {
      public:
        typedef microseconds                         duration; ///< ici on a changé nano en micro
        typedef duration::rep                        rep;
        typedef duration::period                     period;
        typedef chrono::time_point<process_user_cpu_clock_micro_GR>    time_point; ///< ici ajout de _micro_GR
        BOOST_STATIC_CONSTEXPR bool is_steady =             true;

        static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
        static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
    };

    class BOOST_CHRONO_DECL process_system_cpu_clock_micro_GR ///< ajout de _micro_GR
    {
      public:
        typedef microseconds                         duration; ///< ici on a changé nano en micro
        typedef duration::rep                        rep;
        typedef duration::period                     period;
        typedef chrono::time_point<process_system_cpu_clock_micro_GR>    time_point; ///< ici ajout de _micro_GR
        BOOST_STATIC_CONSTEXPR bool is_steady =             true;

        static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
        static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
    };
#endif

}

/// GR : ajout dans le namespace chrono
  namespace chrono
  {
    typedef process_times<microseconds::rep> process_cpu_clock_times_micro_GR; ///< nano en micro et ajout de _micro_GR
  #if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
      class BOOST_CHRONO_DECL process_cpu_clock_micro_GR ///< ajout de _micro_GR
      {
      public:

          typedef process_cpu_clock_times_micro_GR          times; ///< ajout de _micro_GR
          typedef boost::chrono::duration<times,  micro>    duration; ///< nano en micro
          typedef duration::rep                             rep;
          typedef duration::period                          period;
          typedef chrono::time_point<process_cpu_clock_micro_GR>  time_point;  ///< ajout de _micro_GR
          BOOST_STATIC_CONSTEXPR bool is_steady =           true;

          static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
  #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
          static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
  #endif
      };
  #endif


      template<class CharT>
      struct clock_string<process_real_cpu_clock_micro_GR, CharT> ///< ajout de _micro_GR
      {
        static std::basic_string<CharT> name()
        {
          static const CharT
              u[] =
                  { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l', '_', 'c', 'l', 'o', 'c', 'k' };
          static const std::basic_string<CharT> str(u, u + sizeof(u)
              / sizeof(u[0]));
          return str;
        }
        static std::basic_string<CharT> since()
        {
          const CharT
              u[] =
                  { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
          const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
          return str;
        }
      };

  #if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
      template<class CharT>
      struct clock_string<process_user_cpu_clock_micro_GR, CharT> ///< ajout de _micro_GR
      {
        static std::basic_string<CharT> name()
        {
          static const CharT
              u[] =
                  { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r', '_', 'c', 'l', 'o', 'c', 'k' };
          static const std::basic_string<CharT> str(u, u + sizeof(u)
              / sizeof(u[0]));
          return str;
        }
        static std::basic_string<CharT> since()
        {
          const CharT
              u[] =
                  { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
          const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
          return str;
        }
      };

      template<class CharT>
      struct clock_string<process_system_cpu_clock_micro_GR, CharT> ///< ajout de _micro_GR
      {
        static std::basic_string<CharT> name()
        {
          static const CharT
              u[] =
                  { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
          static const std::basic_string<CharT> str(u, u + sizeof(u)
              / sizeof(u[0]));
          return str;
        }
        static std::basic_string<CharT> since()
        {
          const CharT
              u[] =
                  { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
          const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
          return str;
        }
      };

      template<class CharT>
      struct clock_string<process_cpu_clock_micro_GR, CharT>   ///< ajout de _micro_GR
      {
        static std::basic_string<CharT> name()
        {
          static const CharT u[] =
          { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'c', 'l', 'o', 'c', 'k' };
          static const std::basic_string<CharT> str(u, u + sizeof(u)
              / sizeof(u[0]));
          return str;
        }
        static std::basic_string<CharT> since()
        {
          const CharT
              u[] =
                  { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
          const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
          return str;
        }
      };
  #endif

  } // namespace chrono

 } // namespace boost

 /// @}  // end of group


#ifndef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
#else
#include <boost/chrono/detail/inlined/process_cpu_clocks.hpp>
#endif
#endif

#endif  // BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP

