Table of Contents

Class TimeToStringCastingImpl

Namespace
NumSharp
Assembly
NumSharp.dll

The cast from datetime64 / timedelta64 into a string class — NumPy's time_to_string_resolve_descriptors (datetime.c): always unsafe; a missing destination is the ISO 8601 width of the unit for datetime64 (NpyDatetime_GetDatetimeISO8601StrLen) and 21 characters for timedelta64.

public sealed class TimeToStringCastingImpl : CastingImpl
Inheritance
TimeToStringCastingImpl
Inherited Members

Remarks

Descriptor level only (can_cast, promote_types answers): the datetime storage and its text formatting are Stage C of docs/plans/dtype-system.md.

Methods

resolve_descriptors(DType[], DType[], out long)

NumPy's time_to_string_resolve_descriptors: a given destination is kept as is for datetime64 (NumPy does not check the length here); otherwise — and always for timedelta64 — a fresh descriptor of the ISO width (datetime) or 21 characters (timedelta) is chosen.

public override NPY_CASTING resolve_descriptors(DType[] givenDescrs, DType[] loopDescrs, out long viewOffset)

Parameters

givenDescrs DType[]

The datetime source and the requested string destination (may be null).

loopDescrs DType[]

Receives the descriptors the cast runs on.

viewOffset long

Always NoView.

Returns

NPY_CASTING

Always unsafe.