{"id":16481883,"url":"https://github.com/angularsen/prettyprintnet","last_synced_at":"2025-10-27T17:31:51.618Z","repository":{"id":10102005,"uuid":"12164948","full_name":"angularsen/PrettyPrintNet","owner":"angularsen","description":"Human friendly, textual representations of duration, file size and transfer rate using standard .NET types.","archived":false,"fork":false,"pushed_at":"2016-01-12T13:00:54.000Z","size":1632,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T21:49:59.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angularsen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-16T18:11:49.000Z","updated_at":"2023-03-03T03:59:12.000Z","dependencies_parsed_at":"2022-07-11T06:00:33.873Z","dependency_job_id":null,"html_url":"https://github.com/angularsen/PrettyPrintNet","commit_stats":null,"previous_names":["anjdreas/prettyprintnet"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angularsen%2FPrettyPrintNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angularsen%2FPrettyPrintNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angularsen%2FPrettyPrintNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angularsen%2FPrettyPrintNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angularsen","download_url":"https://codeload.github.com/angularsen/PrettyPrintNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238535798,"owners_count":19488593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T13:08:57.345Z","updated_at":"2025-10-27T17:31:46.132Z","avatar_url":"https://github.com/angularsen.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"PrettyPrint.NET\n==============\n\nHuman friendly, textual representations of TimeSpan and file size.\n\nInstall\n=======\nTo install PrettyPrint.NET, run the following command in the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console) or go to the [NuGet site](https://www.nuget.org/packages/PrettyPrintNet/) for the complete relase history.\n\n![Install-Package PrettyPrintNet](Docs/Images/install_package_prettyprintnet.png \"Install-Package PrettyPrintNet\")\n\nBuild Targets:\n* .NET 3.5 Client\n* Portable .NET 4.0 Profile 328 (Silverlight 5, Win8, WinPhone8.1, WinPhoneSl8, Monotouch, Monoandroid)\n* Portable .NET 4.5 Profile 259 (Win8, WinPhone8.1, WinPhoneSl8, Monotouch, Monoandroid)\n\nFeatures\n========\n## TimeSpan.ToPrettyString()\n```csharp\nvar t = new TimeSpan(hours: 3, minutes: 4, seconds: 0);\n\n// Default is 1 unit, long representation, use units from days to seconds, round smallest unit down\nt.ToPrettyString();                                             // \"3 hours\"\n\n// 3 units requested, but seconds is zero and skipped\nt.ToPrettyString(3);                                            // \"3 hours and 4 minutes\"\n\n// Four different unit representations\nt.ToPrettyString(2, UnitStringRepresentation.Long);             // \"3 hours and 4 minutes\"\nt.ToPrettyString(2, UnitStringRepresentation.Short);            // \"3 hrs 4 mins\"\nt.ToPrettyString(2, UnitStringRepresentation.CompactWithSpace); // \"3h 4m\"\nt.ToPrettyString(2, UnitStringRepresentation.Compact);          // \"3h4m\"\n\n// Three types of rounding of the smallest unit, defaulting to 'ToNearestOrUp'\n// As an example, ToTimeRemainingString() uses IntegerRounding.Up to not\n// show \"0 seconds\" remaining when there is 0.9 seconds remaining.\nvar t2 = new TimeSpan(hours: 3, minutes: 30, seconds: 0);\nt2.ToPrettyString(1, lowestUnitRounding: IntegerRounding.Down);          // \"3 hours\"\nt2.ToPrettyString(1, lowestUnitRounding: IntegerRounding.Up);            // \"4 hours\"\nt2.ToPrettyString(1, lowestUnitRounding: IntegerRounding.ToNearestOrUp); // \"4 hours\"\n```\n\n## TimeSpan.ToTimeRemainingString()\nThis is helpful to avoid showing strings like \"0 seconds remaining\" or \"9 seconds remaining\" when it really is 9.999 seconds remaining. It basically just calls ```ToPrettyString()``` with ```IntegerRounding.Up```.\n```csharp\nTimeSpan.FromSeconds(  60.1).TotimeRemainingString(); // \"1 minute and 1 second\"\nTimeSpan.FromSeconds(  60  ).TotimeRemainingString(); // \"1 minute\"\nTimeSpan.FromSeconds(  59.9).TotimeRemainingString(); // \"1 minute\"\nTimeSpan.FromSeconds(   1.1).TotimeRemainingString(); // \"2 seconds\"\nTimeSpan.FromSeconds(   1  ).TotimeRemainingString(); // \"1 second\"\nTimeSpan.FromSeconds(   0.1).TotimeRemainingString(); // \"1 second\"\nTimeSpan.FromSeconds(   0  ).TotimeRemainingString(); // \"0 seconds\" \n```\n\n## TODO Document FileSizeExtensions\n \nOther things to add\n===========\n* File transfer rate\n* Money\n* More cultures and translations\n\nAlready Well Covered\n====================\n* Time of day, date and timezones by [DateTime](http://msdn.microsoft.com/en-us/library/system.datetime.aspx) or [NodaTime](https://www.nuget.org/packages/NodaTime)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangularsen%2Fprettyprintnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangularsen%2Fprettyprintnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangularsen%2Fprettyprintnet/lists"}