# PetscGetTime

Returns the current time of day in seconds. This returns wall-clock time.

### Synopsis

    PetscErrorCode PETSC_DLLEXPORT PetscGetTime(PetscLogDouble *t)

Not Collective

### Output Parameter

v -time counter

### Usage

          #include "petsctime.h"

          PetscLogDouble v1,v2,elapsed_time;
          ierr = PetscGetTime(&v1);CHKERRQ(ierr);
          .... perform some calculation ...
          ierr = PetscGetTime(&v2);CHKERRQ(ierr);
          elapsed_time = v2 - v1;

### Notes

Requires explicitly including "petsctime.h"

Since the PETSc libraries incorporate timing of phases and operations, PetscGetTime() is intended only for timing of application codes. The options database commands -log, -log_summary, and -log_all activate PETSc library timing. See the users manual for further details.

### See Also

PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd(), PetscLogStagePush(),
PetscLogStagePop(), PetscLogStageRegister(), PetscGetFlops()

### Keywords

get, time

Level:intermediate
Location:src/sys/time/ptime.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/ksp/examples/tutorials/ex10.c.html
src/snes/examples/tutorials/ex27.c.html