CLN/PERF: simplify tslib.get_time_micros 
State: closed

`tslib.get_time_micros` implementation is way more complicated than it needs to be.  Instead of calling `dt64_to_dtstruct` in a loop, this changes the function to one call to `np.mod`.

AFAIK the `np.mod` call is to the python function, not sure if numpy exposes a cython version of mod.   Then again, the function is only used once in `indexes.datetimes` and isn't all that perf sensitive.  It might not need to be in cython in the first place.

Re-wrote inaccurate docstring.

Labels:
name: Performance
description: Memory or execution speed performance
name: Clean

Comments:
`asv` benchmarks as usual before we can merge this.
> asv benchmarks as usual before we can merge this.

Since its just one function, how about just a timeit result

0.21.0
```
In [1]: import numpy as np
In [2]: import pandas as pd
In [3]: np.random.seed(5678)
In [4]: arr = (np.random.randn(10000) * 1e7).astype(np.int64)
In [5]: %timeit res = tslib.get_time_micros(arr)
1000 loops, best of 3: 322 µs per loop
```

PR: 
```
In [5]: %timeit res = tslib.get_time_micros(arr)
1000 loops, best of 3: 238 µs per loop
```
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=h1) Report
> Merging [#18389](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e6eac0b308af9869ee123caa8c256bd8a7cc126b?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18389/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18389      +/-   ##
==========================================
- Coverage   91.35%   91.34%   -0.02%     
==========================================
  Files         163      163              
  Lines       49695    49695              
==========================================
- Hits        45401    45392       -9     
- Misses       4294     4303       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.14% <100%> (ø)` | :arrow_up: |
| #single | `39.66% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.49% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=footer). Last update [e6eac0b...26ec1f3](https://codecov.io/gh/pandas-dev/pandas/pull/18389?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

needs an update according to comments
No thoughts on the "just put this one-liner in the one place its used" idea?
> No thoughts on the "just put this one-liner in the one place its used" idea?

yeah, but rather actually have these defined in a single place (rather than scattered about), so in same vein could move ``_to_time_micros`` here as well.
> yeah, but rather actually have these defined in a single place (rather than scattered about),

I'm with you on the non-scattering.  Anyway, moved this to fields a few minutes ago.
ok, let's add to list to remove need for this